File: scalable_iph_constants.h

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (318 lines) | stat: -rw-r--r-- 15,290 bytes parent folder | download | duplicates (6)
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
// 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 CHROMEOS_ASH_COMPONENTS_SCALABLE_IPH_SCALABLE_IPH_CONSTANTS_H_
#define CHROMEOS_ASH_COMPONENTS_SCALABLE_IPH_SCALABLE_IPH_CONSTANTS_H_

#include <ostream>

#include "base/component_export.h"

namespace scalable_iph {

inline constexpr char16_t kNotificationSummaryText[] = u"Welcome Tips";

inline constexpr char kScalableIphDebugHost[] = "scalable-iph-debug";
inline constexpr char kScalableIphDebugURL[] =
    "chrome-untrusted://scalable-iph-debug/";

// Those ids are from //chrome/browser/web_applications/web_app_id_constants.h.
// We cannot include the file from this component as //chromeos should not
// depend on //chrome/browser. Those values are tested against values in
// web_app_id_constants.h in `AppListItemActivationWebApp` test. Remember to add
// one if you add new one.
inline constexpr char kWebAppYouTubeAppId[] =
    "agimnkijcaahngcdmfeangaknmldooml";
inline constexpr char kWebAppGoogleDocsAppId[] =
    "mpnpojknpmmopombnjdcgaaiekajbnjb";

// `kWebAppGooglePhotosAppId` is not coming from web_app_id_constants.h.
inline constexpr char kWebAppGooglePhotosAppId[] =
    "ncmjhecbjeaamljdfahankockkkdmedg";

// Android app ids can be found in
// //chrome/browser/ash/app_list/arc/arc_app_utils.cc. We cannot include the
// file from this directory same with the above web_app_id_constants.h.
inline constexpr char kAndroidGooglePhotosAppId[] =
    "fdbkkojdbojonckghlanfaopfakedeca";

// Android app ids can be found in
// //chrome/browser/ash/app_list/arc/arc_app_utils.cc. We cannot include the
// file from this directory same with the above web_app_id_constants.h.
inline constexpr char kAndroidAppGooglePhotosAppId[] =
    "fdbkkojdbojonckghlanfaopfakedeca";
inline constexpr char kAndroidAppGooglePlayStoreAppId[] =
    "cnbgggchhmkkdmeppjobngjoejnihlei";

enum class COMPONENT_EXPORT(SCALABLE_IPH_CONSTANTS) ActionType {
  // `kInvalid` is reserved to be used as an initial value or when the server
  // side config cannot be parsed.
  kInvalid = 0,
  kOpenChrome = 1,
  kOpenLauncher = 2,  // Not implemented for V1 of Scalable IPH
  kOpenPersonalizationApp = 3,
  kOpenPlayStore = 4,
  kOpenGoogleDocs = 5,
  kOpenGooglePhotos = 6,
  kOpenSettingsPrinter = 7,
  kOpenPhoneHub = 8,
  kOpenYouTube = 9,
  kOpenFileManager = 10,
  kOpenHelpAppPerks = 11,
  kOpenChromebookPerksWeb = 12,
  kOpenChromebookPerksGfnPriority2022 = 13,
  kOpenChromebookPerksMinecraft2023 = 14,
  kOpenChromebookPerksMinecraftRealms2023 = 15,
  kLastAction = kOpenChromebookPerksMinecraftRealms2023,
};

COMPONENT_EXPORT(SCALABLE_IPH_CONSTANTS)
std::ostream& operator<<(std::ostream& out, ActionType action_type);

// Constants for action types, has 1 to 1 mapping with the ActionType.
// Used in server side config.
inline constexpr char kActionTypeOpenChrome[] = "OpenChrome";
inline constexpr char kActionTypeOpenLauncher[] = "OpenLauncher";
inline constexpr char kActionTypeOpenPersonalizationApp[] =
    "OpenPersonalizationApp";
inline constexpr char kActionTypeOpenPlayStore[] = "OpenPlayStore";
inline constexpr char kActionTypeOpenGoogleDocs[] = "OpenGoogleDocs";
inline constexpr char kActionTypeOpenGooglePhotos[] = "OpenGooglePhotos";
inline constexpr char kActionTypeOpenSettingsPrinter[] = "OpenSettingsPrinter";
inline constexpr char kActionTypeOpenPhoneHub[] = "OpenPhoneHub";
inline constexpr char kActionTypeOpenYouTube[] = "OpenYouTube";
inline constexpr char kActionTypeOpenFileManager[] = "OpenFileManager";
inline constexpr char kActionTypeOpenHelpAppPerks[] = "OpenHelpAppPerks";
inline constexpr char kActionTypeOpenChromebookPerksWeb[] =
    "OpenChromebookPerksWeb";
inline constexpr char kActionTypeOpenChromebookPerksGfnPriority2022[] =
    "OpenChromebookPerksGfnPriority2022";
inline constexpr char kActionTypeOpenChromebookPerksMinecraft2023[] =
    "OpenChromebookPerksMinecraft2023";
// Use shorter string to keep Finch config payload size smaller.
inline constexpr char kActionTypeOpenChromebookPerksMinecraftRealms2023[] =
    "PerksMinecraftRealms2023";

// Constants for events.
// Naming convention: Camel case starting with a capital letter. Note that
// Scalable Iph event names must start with `ScalableIph` as Iph event names
// live in a global namespace.

// Constants for help app events, has 1 to 1 mapping with the ActionType.
inline constexpr char kEventNameHelpAppActionTypeOpenChrome[] =
    "ScalableIphHelpAppActionOpenChrome";
inline constexpr char kEventNameHelpAppActionTypeOpenLauncher[] =
    "ScalableIphHelpAppActionOpenLauncher";
inline constexpr char kEventNameHelpAppActionTypeOpenPersonalizationApp[] =
    "ScalableIphHelpAppActionOpenPersonalizationApp";
inline constexpr char kEventNameHelpAppActionTypeOpenPlayStore[] =
    "ScalableIphHelpAppActionOpenPlayStore";
inline constexpr char kEventNameHelpAppActionTypeOpenGoogleDocs[] =
    "ScalableIphHelpAppActionOpenGoogleDocs";
inline constexpr char kEventNameHelpAppActionTypeOpenGooglePhotos[] =
    "ScalableIphHelpAppActionOpenGooglePhotos";
inline constexpr char kEventNameHelpAppActionTypeOpenSettingsPrinter[] =
    "ScalableIphHelpAppActionOpenSettingsPrinter";
inline constexpr char kEventNameHelpAppActionTypeOpenPhoneHub[] =
    "ScalableIphHelpAppActionOpenPhoneHub";
inline constexpr char kEventNameHelpAppActionTypeOpenYouTube[] =
    "ScalableIphHelpAppActionOpenYouTube";
inline constexpr char kEventNameHelpAppActionTypeOpenFileManager[] =
    "ScalableIphHelpAppActionOpenFileManager";

// Constants for app list / shelf item activation.
inline constexpr char kEventNameAppListItemActivationYouTube[] =
    "ScalableIphAppListItemActivationYouTube";
inline constexpr char kEventNameAppListItemActivationGoogleDocs[] =
    "ScalableIphAppListItemActivationGoogleDocs";
inline constexpr char kEventNameAppListItemActivationGooglePhotosWeb[] =
    "ScalableIphAppListItemActivationGooglePhotosWeb";
inline constexpr char kEventNameAppListItemActivationGooglePlayStore[] =
    "ScalableIphAppListItemActivationOpenGooglePlayStore";
inline constexpr char kEventNameAppListItemActivationGooglePhotosAndroid[] =
    "ScalableIphAppListItemActivationOpenGooglePhotosAndroid";

// Constants for shelf item activation.
inline constexpr char kEventNameShelfItemActivationYouTube[] =
    "ScalableIphShelfItemActivationYouTube";
inline constexpr char kEventNameShelfItemActivationGoogleDocs[] =
    "ScalableIphShelfItemActivationGoogleDocs";
inline constexpr char kEventNameShelfItemActivationGooglePhotosWeb[] =
    "ScalableIphShelfItemActivationGooglePhotosWeb";
inline constexpr char kEventNameShelfItemActivationGooglePhotosAndroid[] =
    "ScalableIphShelfItemActivationGooglePhotosAndroid";
inline constexpr char kEventNameShelfItemActivationGooglePlay[] =
    "ScalableIphShelfItemActivationGooglePlay";

// Recorded when the personalization hub app is opened.
inline constexpr char kEventNameOpenPersonalizationApp[] =
    "ScalableIphOpenPersonalizationApp";
// Recorded when a print job is created.
inline constexpr char kEventNamePrintJobCreated[] =
    "ScalableIphPrintJobCreated";

// Recorded when a game window is opened.
inline constexpr char kEventNameGameWindowOpened[] =
    "ScalableIphGameWindowOpened";

// `FiveMinTick` event is recorded every five minutes after OOBE completion.
inline constexpr char kEventNameFiveMinTick[] = "ScalableIphFiveMinTick";

// `Unlocked` event is recorded every unlock of the lock screen or
// `SuspendDone` if the lock screen is not enabled.
inline constexpr char kEventNameUnlocked[] = "ScalableIphUnlocked";

// `AppListShown` event is recorded every time an app list (launcher) becomes
// visible. An expected usage of this event is for `event_used` of an app list
// IPH.
inline constexpr char kEventNameAppListShown[] = "ScalableIphAppListShown";

// All Scalable Iph configs must have version number fields. Scalable Iph
// ignores a config if it does not have a field with a supported version number.
// For now, we guarantee nothing about forward or backward compatibility.
inline constexpr char kCustomParamsVersionNumberParamName[] =
    "x_CustomVersionNumber";
inline constexpr int kCurrentVersionNumber = 1;

// Constants for custom conditions.
// Naming convention:
// Camel case starting with a capital letter. Note that param names must start
// with `x_CustomCondition` prefix:
// - `x_` is from the feature engagement framework. The framework ignores any
//   params start with it.
// - `CustomCondition` indicates this param is for custom condition. We use
//   params for other things as well, e.g. UIs.
//
// Usage:
// Custom conditions is an extension implemented in `ScalableIph` framework.
// Those conditions are checked in addition to other event conditions of the
// feature engagement framework.
//
// Example:
// "x_CustomConditionsNetworkConnection": "Online"
//
// `NetworkConnection` condition is satisfied if a device is online. For now, we
// only support `Online` as the expected condition.
inline constexpr char kCustomConditionNetworkConnectionParamName[] =
    "x_CustomConditionNetworkConnection";
inline constexpr char kCustomConditionNetworkConnectionOnline[] = "Online";

// `ClientAgeInDays` condition is satisfied if a device's client age is on or
// below the specified number of days. The number must be a positive integer
// including 0.
// - The day count starts from 0. For example, if you specify 0 as a value, it
//   means that a profile is created in the last 24 hours.
// - The day in this condition does not match with the calendar day. If a
//   profile is created at 3 pm on May 1st, the day 0 ends at 3 pm on May 2nd.
inline constexpr char kCustomConditionClientAgeInDaysParamName[] =
    "x_CustomConditionClientAgeInDays";

// `HasSavedPrinters` condition is true if there is at least a saved printer.
// Valid values are either `True` or `False`.
inline constexpr char kCustomConditionHasSavedPrintersParamName[] =
    "x_CustomConditionHasSavedPrinter";
inline constexpr char kCustomConditionHasSavedPrintersValueTrue[] = "True";
inline constexpr char kCustomConditionHasSavedPrintersValueFalse[] = "False";

// `PhoneHubOnboardingEligible` condition is true if feature status of phone hub
// is either `kEligiblePhoneButNotSetUp` or `kDisabled`. Note that `kDisabled`
// is a state where a user can enable it from settings. It means that the user
// can set up phone hub. Only `True` is the supported value for now.
inline constexpr char kCustomConditionPhoneHubOnboardingEligibleParamName[] =
    "x_CustomConditionPhoneHubOnboardingEligible";
inline constexpr char kCustomConditionPhoneHubOnboardingEligibleValueTrue[] =
    "True";

// `TriggerEvent` condition is true if an IPH conditions check is triggered by a
// record of an event specified in this condition. Note that only sub-set of
// events can trigger an IPH condition check as specified in
// `kIphTriggeringEvents` in `scalable_iph.cc`.
inline constexpr char kCustomConditionTriggerEventParamName[] =
    "x_CustomConditionTriggerEvent";

// `UiType` param indicates which IPH UI is used for an event config.
inline constexpr char kCustomUiTypeParamName[] = "x_CustomUiType";
inline constexpr char kCustomUiTypeValueNotification[] = "Notification";
inline constexpr char kCustomUiTypeValueBubble[] = "Bubble";
inline constexpr char kCustomUiTypeValueNone[] = "None";

enum class COMPONENT_EXPORT(SCALABLE_IPH_CONSTANTS) UiType {
  kNotification,
  kBubble,
  kNone,
};

// Parameters for a notification UI. All fields are required field.
// - Notification ID: the id used to add and remove a notification.
// - Title: a title text of a notification.
// - Body text: a body text of a notification.
// - Button text: a text of a button in a notification.
// - Image type: a type of preview image(s) in a notification.
// - Icon: an icon of a notification. Default is Chrome icon.
// - Source text: a source text of a notification. Default is ChromeOS.
// - Summary text: a summary text of a notification. Default is Welcome Tips.
//
// Default value of summary text is set to Welcome Tips as ScalableIph is/was
// primarily implemented/used for Welcome Tips. We can update this behavior
// later with a new version number.
inline constexpr char kCustomNotificationIdParamName[] =
    "x_CustomNotificationId";
inline constexpr char kCustomNotificationTitleParamName[] =
    "x_CustomNotificationTitle";
inline constexpr char kCustomNotificationBodyTextParamName[] =
    "x_CustomNotificationBodyText";
inline constexpr char kCustomNotificationButtonTextParamName[] =
    "x_CustomNotificationButtonText";
inline constexpr char kCustomNotificationImageTypeParamName[] =
    "x_CustomNotificationImageType";
inline constexpr char kCustomNotificationImageTypeValueWallpaper[] =
    "Wallpaper";
inline constexpr char kCustomNotificationImageTypeValueMinecraft[] =
    "Minecraft";
inline constexpr char kCustomNotificationIconParamName[] =
    "x_CustomNotificationIcon";
inline constexpr char kCustomNotificationIconValueDefault[] = "Default";
inline constexpr char kCustomNotificationIconValueRedeem[] = "Redeem";
inline constexpr char kCustomNotificationSourceTextParamName[] =
    "x_CustomNotificationSourceText";
inline constexpr char kCustomNotificationSourceTextValueDefault[] = "ChromeOS";
inline constexpr char kCustomNotificationSummaryTextParamName[] =
    "x_CustomNotificationSummaryText";
inline constexpr char kCustomNotificationSummaryTextValueWelcomeTips[] =
    "WelcomeTips";
inline constexpr char kCustomNotificationSummaryTextValueNone[] = "None";

// Parameters for a bubble UI. All fields are required field.
// - Bubble ID: the id used to add and remove a bubble.
// - Title: the title of a bubble.
// - Text: the text of a bubble.
// - Button text: a text of a button in a bubble.
// Currently only used for the help app nudge:
// - Anchor view app ID: app id of the view to which a bubble is anchored.
inline constexpr char kCustomBubbleIdParamName[] = "x_CustomBubbleId";
inline constexpr char kCustomBubbleTitleParamName[] = "x_CustomBubbleTitle";
inline constexpr char kCustomBubbleTextParamName[] = "x_CustomBubbleText";
inline constexpr char kCustomBubbleButtonTextParamName[] =
    "x_CustomBubbleButtonText";
inline constexpr char kCustomBubbleIconParamName[] = "x_CustomBubbleIcon";
inline constexpr char kCustomBubbleAnchorViewAppIdParamName[] =
    "x_CustomBubbleAnchorViewAppId";

// Constants for bubble icons, has 1 to 1 mapping with the BubbleIcon.
// Used in server side config.
inline constexpr char kBubbleIconChromeIcon[] = "ChromeIcon";
inline constexpr char kBubbleIconPlayStoreIcon[] = "PlayStoreIcon";
inline constexpr char kBubbleIconGoogleDocsIcon[] = "GoogleDocsIcon";
inline constexpr char kBubbleIconGooglePhotosIcon[] = "GooglePhotosIcon";
inline constexpr char kBubbleIconPrintJobsIcon[] = "PrintJobsIcon";
inline constexpr char kBubbleIconYouTubeIcon[] = "YouTubeIcon";

// Parameters for action.
inline constexpr char kCustomButtonActionTypeParamName[] =
    "x_CustomButtonActionType";
inline constexpr char kCustomButtonActionEventParamName[] = "event_used";

}  // namespace scalable_iph

#endif  // CHROMEOS_ASH_COMPONENTS_SCALABLE_IPH_SCALABLE_IPH_CONSTANTS_H_