1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
|
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_SEGMENTATION_PLATFORM_EMBEDDER_HOME_MODULES_TIPS_MANAGER_CONSTANTS_H_
#define COMPONENTS_SEGMENTATION_PLATFORM_EMBEDDER_HOME_MODULES_TIPS_MANAGER_CONSTANTS_H_
#include <string>
#include <string_view>
namespace segmentation_platform {
// Identifiers for distinct in-product tips managed by the `TipsManager`.
//
// Each identifier represents a specific tip or variant, allowing the system
// to track, manage, and present the correct tip to the user.
//
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
//
// LINT.IfChange(TipIdentifier)
enum class TipIdentifier {
// Represents an unknown tip.
kUnknown = 0,
// Tip promoting the Lens Search feature.
kLensSearch = 1,
// Tip promoting the Lens Shop feature.
kLensShop = 2,
// Tip promoting the Lens Translate feature.
kLensTranslate = 3,
// Tip about changing the address bar position.
kAddressBarPosition = 4,
// Tip encouraging users to save passwords.
kSavePasswords = 5,
// Tip promoting the autofill passwords feature.
kAutofillPasswords = 6,
// Tip promoting enhanced safe browsing.
kEnhancedSafeBrowsing = 7,
kMaxValue = kEnhancedSafeBrowsing,
};
// LINT.ThenChange(/components/segmentation_platform/embedder/home_modules/tips_manager/constants.cc:NameForTipIdentifier)
// Returns the human-readable string representation of the given `tip`.
std::string NameForTipIdentifier(TipIdentifier tip);
// Returns the `TipIdentifier` corresponding to the given string representation,
// `name`. If the input string is invalid or unknown, this function returns
// `TipIdentifier::kUnknown`.
TipIdentifier TipIdentifierForName(std::string_view name);
// Represents the context in which a tip is presented to the user. This is
// used for tracking, analysis, and potentially adapting tip behavior or
// appearance based on the presentation context.
//
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
//
// LINT.IfChange(TipPresentationContext)
enum class TipPresentationContext {
// Represents an unknown presentation context.
kUnknown = 0,
// Tip presented within the Magic Stack on the Chrome iOS homepage.
kIOSMagicStack = 1,
kMaxValue = kIOSMagicStack,
};
// LINT.ThenChange(/components/segmentation_platform/embedder/home_modules/tips_manager/constants.cc:NameForTipPresentationContext)
// Returns the string representation of `context`.
std::string NameForTipPresentationContext(TipPresentationContext context);
// Key for the timestamp representing the first time a signal was observed
// (`base::Value`).
extern const char kFirstObservedTime[];
// Key for the timestamp representing the latest time a signal was observed
// (`base::Value`).
extern const char kLastObservedTime[];
// Key for the total number of times a signal has been observed (`int`).
extern const char kTotalOccurrences[];
// Dictionary pref to maintain the history of signals notified to the Tips
// manager. The dictionary has the following structure:
//
// Key: A unique `std::string` matching a signal declared in
// signal_constants (segmentation_platform::signals).
//
// Value: A dictionary with the following fields:
// - first_observed_time: Timestamp (`base::Value`) representing the first
// time the signal was observed.
// - last_observed_time: Timestamp (`base::Value`) representing the latest
// time the signal was observed.
// - total_occurrences: The total number of times this signal has been
// observed (`int`).
extern const char kTipsSignalHistory[];
// Pref names
// Whether or not the Address Bar Position ephemeral module has been
// interacted with.
extern const char kAddressBarPositionEphemeralModuleInteractedPref[];
// Whether or not the Autofill Passwords ephemeral module has been interacted
// with.
extern const char kAutofillPasswordsEphemeralModuleInteractedPref[];
// Whether or not the Enhanced Safe Browsing ephemeral module has been
// interacted with.
extern const char kEnhancedSafeBrowsingEphemeralModuleInteractedPref[];
// Whether or not the Save Passwords ephemeral module has been interacted with.
extern const char kSavePasswordsEphemeralModuleInteractedPref[];
// Whether or not the Lens ephemeral module has been interacted with.
extern const char kLensEphemeralModuleInteractedPref[];
// Whether or not the Lens Search variation has been interacted with.
extern const char kLensEphemeralModuleSearchVariationInteractedPref[];
// Whether or not the Lens Shop variation has been interacted with.
extern const char kLensEphemeralModuleShopVariationInteractedPref[];
// Whether or not the Lens Translate variation has been interacted with.
extern const char kLensEphemeralModuleTranslateVariationInteractedPref[];
} // namespace segmentation_platform
#endif // COMPONENTS_SEGMENTATION_PLATFORM_EMBEDDER_HOME_MODULES_TIPS_MANAGER_CONSTANTS_H_
|