tote tour: Add interaction metrics enum
This enum will be used for logging metrics as well as storing the relevant prefs to accurately record those metrics. Bug: b:311411775 Change-Id: I77a94c216736c25e4dc939544d563453fc8ce9e1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5038370 Commit-Queue: Angus McLean <angusmclean@google.com> Reviewed-by: David Black <dmblack@google.com> Cr-Commit-Position: refs/heads/main@{#1225718}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
7032cf4cd3
commit
5b8b31b72b
@ -955,6 +955,8 @@ component("ash") {
|
||||
"projector/ui/projector_color_button.h",
|
||||
"user_education/holding_space_wallpaper_nudge/holding_space_wallpaper_nudge_controller.cc",
|
||||
"user_education/holding_space_wallpaper_nudge/holding_space_wallpaper_nudge_controller.h",
|
||||
"user_education/holding_space_wallpaper_nudge/holding_space_wallpaper_nudge_metrics.cc",
|
||||
"user_education/holding_space_wallpaper_nudge/holding_space_wallpaper_nudge_metrics.h",
|
||||
"user_education/holding_space_wallpaper_nudge/holding_space_wallpaper_nudge_prefs.cc",
|
||||
"user_education/holding_space_wallpaper_nudge/holding_space_wallpaper_nudge_prefs.h",
|
||||
"user_education/user_education_class_properties.cc",
|
||||
@ -3695,6 +3697,7 @@ test("ash_unittests") {
|
||||
"tray_action/test_tray_action_client.h",
|
||||
"tray_action/tray_action_unittest.cc",
|
||||
"user_education/holding_space_wallpaper_nudge/holding_space_wallpaper_nudge_controller_unittest.cc",
|
||||
"user_education/holding_space_wallpaper_nudge/holding_space_wallpaper_nudge_metrics_unittest.cc",
|
||||
"user_education/holding_space_wallpaper_nudge/holding_space_wallpaper_nudge_prefs_unittest.cc",
|
||||
"user_education/user_education_controller_unittest.cc",
|
||||
"user_education/user_education_help_bubble_controller_unittest.cc",
|
||||
|
41
ash/user_education/holding_space_wallpaper_nudge/holding_space_wallpaper_nudge_metrics.cc
Normal file
41
ash/user_education/holding_space_wallpaper_nudge/holding_space_wallpaper_nudge_metrics.cc
Normal file
@ -0,0 +1,41 @@
|
||||
// Copyright 2023 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "ash/user_education/holding_space_wallpaper_nudge/holding_space_wallpaper_nudge_metrics.h"
|
||||
|
||||
#include "base/notreached.h"
|
||||
|
||||
namespace ash::holding_space_wallpaper_nudge_metrics {
|
||||
|
||||
std::string ToString(Interaction interaction) {
|
||||
switch (interaction) {
|
||||
case Interaction::kDroppedFileOnHoldingSpace:
|
||||
return "DroppedFileOnHoldingSpace";
|
||||
case Interaction::kDroppedFileOnWallpaper:
|
||||
return "DroppedFileOnWallpaper";
|
||||
case Interaction::kDraggedFileOverWallpaper:
|
||||
return "DraggedFileOverWallpaper";
|
||||
case Interaction::kOpenedHoldingSpace:
|
||||
return "OpenedHoldingSpace";
|
||||
case Interaction::kPinnedFileFromAnySource:
|
||||
return "PinnedFileFromAnySource";
|
||||
case Interaction::kPinnedFileFromContextMenu:
|
||||
return "PinnedFileFromContextMenu";
|
||||
case Interaction::kPinnedFileFromFilesApp:
|
||||
return "PinnedFileFromFilesApp";
|
||||
case Interaction::kPinnedFileFromHoldingSpaceDrop:
|
||||
return "PinnedFileFromHoldingSpaceDrop";
|
||||
case Interaction::kPinnedFileFromPinButton:
|
||||
return "PinnedFileFromPinButton";
|
||||
case Interaction::kPinnedFileFromWallpaperDrop:
|
||||
return "PinnedFileFromWallpaperDrop";
|
||||
case Interaction::kUsedOtherItem:
|
||||
return "UsedOtherItem";
|
||||
case Interaction::kUsedPinnedItem:
|
||||
return "UsedPinnedItem";
|
||||
}
|
||||
NOTREACHED_NORETURN();
|
||||
}
|
||||
|
||||
} // namespace ash::holding_space_wallpaper_nudge_metrics
|
61
ash/user_education/holding_space_wallpaper_nudge/holding_space_wallpaper_nudge_metrics.h
Normal file
61
ash/user_education/holding_space_wallpaper_nudge/holding_space_wallpaper_nudge_metrics.h
Normal file
@ -0,0 +1,61 @@
|
||||
// Copyright 2023 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ASH_USER_EDUCATION_HOLDING_SPACE_WALLPAPER_NUDGE_HOLDING_SPACE_WALLPAPER_NUDGE_METRICS_H_
|
||||
#define ASH_USER_EDUCATION_HOLDING_SPACE_WALLPAPER_NUDGE_HOLDING_SPACE_WALLPAPER_NUDGE_METRICS_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "ash/ash_export.h"
|
||||
#include "base/containers/enum_set.h"
|
||||
|
||||
namespace ash::holding_space_wallpaper_nudge_metrics {
|
||||
|
||||
// Enums -----------------------------------------------------------------------
|
||||
|
||||
// Enumeration of interactions users may engage in after the Holding Space
|
||||
// wallpaper nudge. These values are persisted to logs. Entries should not be
|
||||
// renumbered and numeric values should never be reused. Be sure to update
|
||||
// `kAllInteractionsSet` accordingly.
|
||||
enum class Interaction {
|
||||
kMinValue = 0,
|
||||
kDroppedFileOnHoldingSpace = kMinValue,
|
||||
kDroppedFileOnWallpaper = 1,
|
||||
kDraggedFileOverWallpaper = 2,
|
||||
kOpenedHoldingSpace = 3,
|
||||
kPinnedFileFromAnySource = 4,
|
||||
kPinnedFileFromContextMenu = 5,
|
||||
kPinnedFileFromFilesApp = 6,
|
||||
kPinnedFileFromHoldingSpaceDrop = 7,
|
||||
kPinnedFileFromPinButton = 8,
|
||||
kPinnedFileFromWallpaperDrop = 9,
|
||||
kUsedOtherItem = 10,
|
||||
kUsedPinnedItem = 11,
|
||||
kMaxValue = kUsedPinnedItem,
|
||||
};
|
||||
|
||||
static constexpr auto kAllInteractionsSet =
|
||||
base::EnumSet<Interaction, Interaction::kMinValue, Interaction::kMaxValue>({
|
||||
Interaction::kDroppedFileOnHoldingSpace,
|
||||
Interaction::kDroppedFileOnWallpaper,
|
||||
Interaction::kDraggedFileOverWallpaper,
|
||||
Interaction::kOpenedHoldingSpace,
|
||||
Interaction::kPinnedFileFromAnySource,
|
||||
Interaction::kPinnedFileFromContextMenu,
|
||||
Interaction::kPinnedFileFromFilesApp,
|
||||
Interaction::kPinnedFileFromHoldingSpaceDrop,
|
||||
Interaction::kPinnedFileFromPinButton,
|
||||
Interaction::kPinnedFileFromWallpaperDrop,
|
||||
Interaction::kUsedOtherItem,
|
||||
Interaction::kUsedPinnedItem,
|
||||
});
|
||||
|
||||
// Utilities -------------------------------------------------------------------
|
||||
|
||||
// Returns a string representation of the given `interaction`.
|
||||
ASH_EXPORT std::string ToString(Interaction interaction);
|
||||
|
||||
} // namespace ash::holding_space_wallpaper_nudge_metrics
|
||||
|
||||
#endif // ASH_USER_EDUCATION_HOLDING_SPACE_WALLPAPER_NUDGE_HOLDING_SPACE_WALLPAPER_NUDGE_METRICS_H_
|
48
ash/user_education/holding_space_wallpaper_nudge/holding_space_wallpaper_nudge_metrics_unittest.cc
Normal file
48
ash/user_education/holding_space_wallpaper_nudge/holding_space_wallpaper_nudge_metrics_unittest.cc
Normal file
@ -0,0 +1,48 @@
|
||||
// Copyright 2023 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "ash/user_education/holding_space_wallpaper_nudge/holding_space_wallpaper_nudge_metrics.h"
|
||||
|
||||
#include "base/containers/enum_set.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
namespace ash::holding_space_wallpaper_nudge_metrics {
|
||||
|
||||
// HoldingSpaceWallpaperNudgeMetricsEnumTest -----------------------------------
|
||||
|
||||
// Base class of tests that verify all valid enum values and no other are
|
||||
// included in the relevant `base::EnumSet`s.
|
||||
using HoldingSpaceWallpaperNudgeMetricsEnumTest = testing::Test;
|
||||
|
||||
// Tests -----------------------------------------------------------------------
|
||||
|
||||
TEST_F(HoldingSpaceWallpaperNudgeMetricsEnumTest, AllInteractions) {
|
||||
// If a value in `Interactions` is added or deprecated, the below switch
|
||||
// statement must be modified accordingly. It should be a canonical list of
|
||||
// what values are considered valid.
|
||||
for (auto interaction : base::EnumSet<Interaction, Interaction::kMinValue,
|
||||
Interaction::kMaxValue>::All()) {
|
||||
bool should_exist_in_all_set = false;
|
||||
|
||||
switch (interaction) {
|
||||
case Interaction::kDroppedFileOnHoldingSpace:
|
||||
case Interaction::kDroppedFileOnWallpaper:
|
||||
case Interaction::kDraggedFileOverWallpaper:
|
||||
case Interaction::kOpenedHoldingSpace:
|
||||
case Interaction::kPinnedFileFromAnySource:
|
||||
case Interaction::kPinnedFileFromContextMenu:
|
||||
case Interaction::kPinnedFileFromFilesApp:
|
||||
case Interaction::kPinnedFileFromHoldingSpaceDrop:
|
||||
case Interaction::kPinnedFileFromPinButton:
|
||||
case Interaction::kPinnedFileFromWallpaperDrop:
|
||||
case Interaction::kUsedOtherItem:
|
||||
case Interaction::kUsedPinnedItem:
|
||||
should_exist_in_all_set = true;
|
||||
}
|
||||
|
||||
EXPECT_EQ(kAllInteractionsSet.Has(interaction), should_exist_in_all_set);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ash::holding_space_wallpaper_nudge_metrics
|
@ -26,6 +26,21 @@ chromium-metrics-reviews@google.com.
|
||||
|
||||
<enums>
|
||||
|
||||
<enum name="HoldingSpaceWallpaperNudgeInteraction">
|
||||
<int value="0" label="kDroppedFileOnHoldingSpace"/>
|
||||
<int value="1" label="kDroppedFileOnWallpaper"/>
|
||||
<int value="2" label="kDraggedFileOverWallpaper"/>
|
||||
<int value="3" label="kOpenedHoldingSpace"/>
|
||||
<int value="4" label="kPinnedFileFromAnySource"/>
|
||||
<int value="5" label="kPinnedFileFromContextMenu"/>
|
||||
<int value="6" label="kPinnedFileFromFilesApp"/>
|
||||
<int value="7" label="kPinnedFileFromHoldingSpaceDrop"/>
|
||||
<int value="8" label="kPinnedFileFromPinButton"/>
|
||||
<int value="9" label="kPinnedFileFromWallpaperDrop"/>
|
||||
<int value="10" label="kUsedOtherItem"/>
|
||||
<int value="11" label="kUsedPinnedItem"/>
|
||||
</enum>
|
||||
|
||||
<enum name="WelcomeTourAbortedReason">
|
||||
<int value="0" label="kUnknown"/>
|
||||
<int value="1" label="kAccelerator"/>
|
||||
|
Reference in New Issue
Block a user