File: 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 (279 lines) | stat: -rw-r--r-- 12,755 bytes parent folder | download | duplicates (3)
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
// Copyright 2022 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_PUBLIC_CONSTANTS_H_
#define COMPONENTS_SEGMENTATION_PLATFORM_PUBLIC_CONSTANTS_H_

#include <string>

#include "components/segmentation_platform/public/proto/output_config.pb.h"
#include "components/segmentation_platform/public/proto/segmentation_platform.pb.h"

namespace segmentation_platform {

// SEGMENTATION_CLIENT_KEYS_BEGIN

// The key to be used for adaptive toolbar feature.
const char kAdaptiveToolbarSegmentationKey[] = "adaptive_toolbar";
const char kAdaptiveToolbarUmaName[] = "AdaptiveToolbar";

// The key is used to decide whether a user has low user engagement with chrome.
// This is a generic model that can be used by multiple features targeting
// low-engaged users. Typically low engaged users are active in chrome below a
// certain threshold number of days over a time period. This is computed using
// Session.TotalDuration histogram.
const char kChromeLowUserEngagementSegmentationKey[] =
    "chrome_low_user_engagement";
const char kChromeLowUserEngagementUmaName[] = "ChromeLowUserEngagement";

// The key is used to decide whether the user likes to use Feed.
const char kFeedUserSegmentationKey[] = "feed_user_segment";
const char kFeedUserSegmentUmaName[] = "FeedUserSegment";

// The key is used to decide whether the user is interested in shopping or not.
const char kShoppingUserSegmentationKey[] = "shopping_user";
const char kShoppingUserUmaName[] = "ShoppingUser";

// The key is used to show a contextual page action.
const char kContextualPageActionsKey[] = "contextual_page_actions";
const char kContextualPageActionsUmaName[] = "ContextualPageActions";

// Determine search users of the browser app.
const char kSearchUserKey[] = "search_user";
const char kSearchUserUmaName[] = "SearchUser";

// Determine power users of the browser app.
const char kPowerUserKey[] = "power_user";
const char kPowerUserUmaName[] = "PowerUser";

// The key is used to decide whether the user is active on multiple synced
// devices.
const char kCrossDeviceUserKey[] = "cross_device_user";
const char kCrossDeviceUserUmaName[] = "CrossDeviceUser";

// Keys related to users of chrome features.
const char kFrequentFeatureUserKey[] = "frequent_feature_user";
const char kFrequentFeatureUserUmaName[] = "FrequentFeatureUser";

// This key is used to decide whether the user uses Chrome intentionally.
const char kIntentionalUserKey[] = "intentional_user";
const char kIntentionalUserUmaName[] = "IntentionalUser";

// Key for user segment that is more likely to use resume features in chrome.
const char kResumeHeavyUserKey[] = "resume_heavy_user";
const char kResumeHeavyUserUmaName[] = "ResumeHeavyUser";

// Key for user segment that is likely switched from Chrome on other devices.
const char kDeviceSwitcherKey[] = "device_switcher";
const char kDeviceSwitcherUmaName[] = "DeviceSwitcher";

// The key is used to decide whether the user is categorised as tablet
// productivity or not.
const char kTabletProductivityUserKey[] = "tablet_productivity_user";
const char kTabletProductivityUserUmaName[] = "TabletProductivityUser";

// The key is used to decide whether the user should receive a web app
// installation promotion.
const char kWebAppInstallationPromoKey[] = "web_app_installation_promo";
const char kWebAppInstallationPromoUmaName[] = "WebAppInstallationPromo";

const char kPasswordManagerUserKey[] = "password_manager_user";
const char kPasswordManagerUserUmaName[] = "PasswordManagerUser";

// Key for segment that tells in which tier the device used by the user belongs.
const char kDeviceTierKey[] = "device_tier";
const char kDeviceTierUmaName[] = "DeviceTier";

const char kTabResumptionClassifierKey[] = "tab_resupmtion_classifier";
const char kTabResumptionClassifierUmaName[] = "TabResumptionClassifier";

// The key is used to rank `URLVisitAggregate` objects leveraged by UI tab
// resumption features.
const char kURLVisitResumptionRankerKey[] = "url_visit_resumption_ranker";
const char kURLVisitResumptionRankerUmaName[] = "URLVisitResumptionRanker";

const char kIosModuleRankerKey[] = "ios_module_ranker";
const char kIosModuleRankerUmaName[] = "IosModuleRanker";

const char kAndroidHomeModuleRankerKey[] = "android_home_module_ranker";
const char kAndroidHomeModuleRankerUmaName[] = "AndroidHomeModuleRanker";

// This key is used to decide what modules a user should see on their Desktop
// New Tab Page.
const char kDesktopNtpModuleKey[] = "desktop_ntp_module";
const char kDesktopNtpModuleUmaName[] = "DesktopNtpModule";

const char kOptimizationTargetSegmentationDummyKey[] = "segmentation_dummy";
const char kOptimizationTargetSegmentationDummyUmaName[] = "SegmentationDummy";

const char kComposePromotionKey[] = "compose_promotion";
const char kComposePromotionUmaName[] = "ComposePromotion";

const char kEphemeralHomeModuleBackendKey[] = "ephemeral_home_module_backend";

const char kIosDefaultBrowserPromoKey[] = "ios_default_browser_promo";
const char kIosDefaultBrowserPromoUmaName[] = "IosDefaultBrowserPromo";
const char kIosDefaultBrowserPromoShowLabel[] = "ShowIosDefaultBrowserPromo";

// The key is used to decide whether the user would use FedCM.
const char kFedCmUserKey[] = "fedcm_user";
const char kFedCmUserUmaName[] = "FedCmUser";

// SEGMENTATION_CLIENT_KEYS_END

// Please keep the UMA names for keys in sync with SegmentationKey variant in
// //tools/metrics/histograms/metadata/segmentation_platform/histograms.xml.
// Should also update the field trials allowlist in
// go/segmentation-field-trials-map.

// Config parameter name specified in experiment configs. Any experiment config
// or feature can include this param and segmentation will enable the config for
// storing cached results.
const char kSegmentationConfigParamName[] =
    "segmentation_platform_add_config_param";

// Parameter names used for defining segmentation config.
// TODO(ssid): These should be deprecated and clients should use
// `kSegmentationConfigParamName` to define config instead.
constexpr char kDefaultModelEnabledParam[] = "enable_default_model";
constexpr char kVariationsParamNameSegmentSelectionTTLDays[] =
    "segment_selection_ttl_days";
constexpr char kVariationsParamNameUnknownSelectionTTLDays[] =
    "unknown_selection_ttl_days";

const char kSubsegmentDiscreteMappingSuffix[] = "_subsegment";

// Returns an UMA histogram variant for the given segment_id.
// TODO(ssid): Move this to stats.cc since, no need to be in public.
std::string SegmentIdToHistogramVariant(proto::SegmentId segment_id);

// Returns Subsegment key for the given `segmentation_key`.
std::string GetSubsegmentKey(const std::string& segmentation_key);

// TODO(shaktisahu): Move these to a nicer location.

// Legacy label used for users not in the segment for binary user segment
// classifier.
const char kLegacyNegativeLabel[] = "Other";

// Labels for adaptive toolbar model.
const char kAdaptiveToolbarModelLabelNewTab[] = "NewTab";
const char kAdaptiveToolbarModelLabelShare[] = "Share";
const char kAdaptiveToolbarModelLabelVoice[] = "Voice";
const char kAdaptiveToolbarModelLabelTranslate[] = "Translate";
const char kAdaptiveToolbarModelLabelAddToBookmarks[] = "AddToBookmarks";
const char kAdaptiveToolbarModelLabelReadAloud[] = "ReadAloud";
const char kAdaptiveToolbarModelLabelOpenInBrowser[] = "OpenInBrowser";

// Labels for contextual page actions model.
const char kContextualPageActionModelLabelDiscounts[] = "discounts";
const char kContextualPageActionModelLabelPriceTracking[] = "price_tracking";
const char kContextualPageActionModelLabelReaderMode[] = "reader_mode";
const char kContextualPageActionModelLabelPriceInsights[] = "price_insights";
const char kContextualPageActionModelLabelTabGrouping[] = "tab_grouping";

// Labels for cross device segment.
const char kNoCrossDeviceUsage[] = "NoCrossDeviceUsage";
const char kCrossDeviceMobile[] = "CrossDeviceMobile";
const char kCrossDeviceDesktop[] = "CrossDeviceDesktop";
const char kCrossDeviceTablet[] = "CrossDeviceTablet";
const char kCrossDeviceMobileAndDesktop[] = "CrossDeviceMobileAndDesktop";
const char kCrossDeviceMobileAndTablet[] = "CrossDeviceMobileAndTablet";
const char kCrossDeviceDesktopAndTablet[] = "CrossDeviceDesktopAndTablet";
const char kCrossDeviceAllDeviceTypes[] = "CrossDeviceAllDeviceTypes";
const char kCrossDeviceOther[] = "CrossDeviceOther";

// Labels for search user model.
// Any updates to these strings need to also update the field trials allowlist
// in go/segmentation-field-trials-map.
const char kSearchUserModelLabelNone[] = "None";
const char kSearchUserModelLabelLow[] = "Low";
const char kSearchUserModelLabelMedium[] = "Medium";
const char kSearchUserModelLabelHigh[] = "High";

// Labels for device tier model.
// Any updates to these strings need to also update the field trials allowlist
// in go/segmentation-field-trials-map.
const char kDeviceTierSegmentLabelNone[] = "None";
const char kDeviceTierSegmentLabelLow[] = "Low";
const char kDeviceTierSegmentLabelMedium[] = "Medium";
const char kDeviceTierSegmentLabelHigh[] = "High";

// Labels for tablet productivity user model.
// Any updates to these strings need to also update the field trials allowlist
// in go/segmentation-field-trials-map.
const char kTabletProductivityUserModelLabelNone[] = "None";
const char kTabletProductivityUserModelLabelMedium[] = "Medium";
const char kTabletProductivityUserModelLabelHigh[] = "High";

// Labels for Android Home modules for ranking.
const char kSingleTab[] = "SingleTab";
const char kPriceChange[] = "PriceChange";
const char kSafetyHub[] = "SafetyHub";
const char kAuxiliarySearch[] = "AuxiliarySearch";

// Input Context keys for freshness for Android Home modules.
const char kSingleTabFreshness[] = "single_tab_freshness";
const char kPriceChangeFreshness[] = "price_change_freshness";
const char kSafetyHubFreshness[] = "safety_hub_freshness";
const char kAuxiliarySearchFreshness[] = "auxiliary_search_freshness";

// Labels for IOS modules for ranking.
const char kMostVisitedTiles[] = "MostVisitedTiles";
const char kShortcuts[] = "Shortcuts";
const char kSafetyCheck[] = "SafetyCheck";
const char kTabResumption[] = "TabResumption";
const char kParcelTracking[] = "ParcelTracking";
const char kPriceTrackingPromo[] = "PriceTrackingPromo";
const char kShopCard[] = "ShopCard";

// Input Context keys for freshness for IOS modules.
const char kMostVisitedTilesFreshness[] = "most_visited_tiles_freshness";
const char kShortcutsFreshness[] = "shortcuts_freshness";
const char kSafetyCheckFreshness[] = "safety_check_freshness";
const char kTabResumptionFreshness[] = "tab_resumption_freshness";
const char kParcelTrackingFreshness[] = "parcel_tracking_freshness";
const char kIsShowingStartSurface[] = "is_showing_start_surface";
const char kShopCardFreshness[] = "shop_card_freshness";

// Labels for desktop new tab page drive module model.
// Any updates to these strings need to also update the field trials allowlist
// in go/segmentation-field-trials-map.
const char kDesktopNtpDriveModuleLabelShow[] = "show_drive";
const char kDesktopNtpDriveModuleLabelDontShow[] = "dont_show_drive";

// Custom inputs for contextual page actions model.
const char kContextualPageActionModelInputPriceTracking[] = "can_track_price";
const char kContextualPageActionModelInputReaderMode[] = "has_reader_mode";
const char kContextualPageActionModelInputPriceInsights[] =
    "has_price_insights";
const char kContextualPageActionModelInputDiscounts[] = "has_discounts";
const char kContextualPageActionModelInputTabGrouping[] =
    "has_tab_grouping_suggestion";

const char kComposePrmotionLabelShow[] = "Show";
const char kComposePrmotionLabelDontShow[] = "DontShow";

// Finch parameter key for sampling rate of the model execution results.
constexpr char kModelExecutionSamplingRateKey[] =
    "model_execution_sampling_rate";

// Finch parameter key for introducing delay(in ms) in model initialization at
// startup.
constexpr char kModelInitializationDelay[] = "model_initialization_delay";

// Input Context keys for FedCM.
const char kFedCmHost[] = "host";
const char kFedCmUrl[] = "url";
const char kFedCmPerPageLoadClickthroughRate[] =
    "per_page_load_clickthrough_rate";
const char kFedCmPerClientClickthroughRate[] = "per_client_clickthrough_rate";
const char kFedCmPerImpressionClickthroughRate[] =
    "per_impression_clickthrough_rate";
const char kFedCmLikelyToSignin[] = "likely_to_signin";
const char kFedCmLikelyInsufficientData[] = "likely_insufficient_data";

}  // namespace segmentation_platform

#endif  // COMPONENTS_SEGMENTATION_PLATFORM_PUBLIC_CONSTANTS_H_