-
Notifications
You must be signed in to change notification settings - Fork 6.6k
/
ui_features.cc
365 lines (299 loc) · 13.5 KB
/
ui_features.cc
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
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/ui_features.h"
#include "base/feature_list.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
namespace features {
// Enables the tab dragging fallback when full window dragging is not supported
// by the platform (e.g. Wayland). See https://crbug.com/896640
BASE_FEATURE(kAllowWindowDragUsingSystemDragDrop,
"AllowWindowDragUsingSystemDragDrop",
base::FEATURE_DISABLED_BY_DEFAULT);
#if !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_ANDROID)
BASE_FEATURE(kDesktopPWAsAppHomePage,
"DesktopPWAsAppHomePage",
base::FEATURE_DISABLED_BY_DEFAULT);
#endif // !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_ANDROID)
// Enables Chrome Labs menu in the toolbar. See https://crbug.com/1145666
BASE_FEATURE(kChromeLabs, "ChromeLabs", base::FEATURE_DISABLED_BY_DEFAULT);
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
// Enables "Tips for Chrome" in Main Chrome Menu | Help.
BASE_FEATURE(kChromeTipsInMainMenu,
"ChromeTipsInMainMenu",
base::FEATURE_DISABLED_BY_DEFAULT);
// Enables "Tips for Chrome" in Main Chrome Menu | Help.
BASE_FEATURE(kChromeTipsInMainMenuNewBadge,
"ChromeTipsInMainMenuNewBadge",
base::FEATURE_DISABLED_BY_DEFAULT);
#endif
// Enables "Chrome What's New" UI.
BASE_FEATURE(kChromeWhatsNewUI,
"ChromeWhatsNewUI",
#if BUILDFLAG(GOOGLE_CHROME_BRANDING) && !defined(ANDROID) && \
!BUILDFLAG(IS_CHROMEOS_LACROS) && !BUILDFLAG(IS_CHROMEOS_ASH)
base::FEATURE_ENABLED_BY_DEFAULT
#else
base::FEATURE_DISABLED_BY_DEFAULT
#endif
);
// Create new Extensions app menu option (removing "More Tools -> Extensions")
// with submenu to manage extensions and visit chrome web store.
BASE_FEATURE(kExtensionsMenuInAppMenu,
"ExtensionsMenuInAppMenu",
base::FEATURE_DISABLED_BY_DEFAULT);
#if !defined(ANDROID)
// Enables "Access Code Cast" UI.
BASE_FEATURE(kAccessCodeCastUI,
"AccessCodeCastUI",
base::FEATURE_ENABLED_BY_DEFAULT);
#endif
// Enables displaying the submenu to open a link with a different profile if
// there is at least one other active profile.
BASE_FEATURE(kDisplayOpenLinkAsProfile,
"DisplayOpenLinkAsProfile",
base::FEATURE_DISABLED_BY_DEFAULT);
// Enables showing the EV certificate details in the Page Info bubble.
BASE_FEATURE(kEvDetailsInPageInfo,
"EvDetailsInPageInfo",
base::FEATURE_ENABLED_BY_DEFAULT);
#if BUILDFLAG(ENABLE_EXTENSIONS)
// Controls whether we use a different UX for simple extensions overriding
// settings.
BASE_FEATURE(kLightweightExtensionOverrideConfirmations,
"LightweightExtensionOverrideConfirmations",
base::FEATURE_ENABLED_BY_DEFAULT);
#endif
// Enables Bookmarks++ Side Panel UI.
BASE_FEATURE(kPowerBookmarksSidePanel,
"PowerBookmarksSidePanel",
base::FEATURE_DISABLED_BY_DEFAULT);
// Enables the QuickCommands UI surface. See https://crbug.com/1014639
BASE_FEATURE(kQuickCommands,
"QuickCommands",
base::FEATURE_DISABLED_BY_DEFAULT);
BASE_FEATURE(kSideSearchFeedback,
"SideSearchFeedback",
base::FEATURE_DISABLED_BY_DEFAULT);
// Displays right-click search results of a highlighted text in side panel,
// So users are not forced to switch to a new tab to view the search results
BASE_FEATURE(kSearchWebInSidePanel,
"SearchWebInSidePanel",
base::FEATURE_DISABLED_BY_DEFAULT);
// Feature that controls whether or not feature engagement configurations can be
// used to control automatic triggering for side search.
BASE_FEATURE(kSideSearchAutoTriggering,
"SideSearchAutoTriggering",
base::FEATURE_ENABLED_BY_DEFAULT);
// Feature param that determines how many times a user has to return to a given
// SRP before we automatically trigger the side search side panel for that SRP
// on a subsequent navigation.
const base::FeatureParam<int> kSideSearchAutoTriggeringReturnCount{
&kSideSearchAutoTriggering, "SideSearchAutoTriggeringReturnCount", 2};
BASE_FEATURE(kSidePanelWebView,
"SidePanelWebView",
base::FEATURE_DISABLED_BY_DEFAULT);
BASE_FEATURE(kSidePanelJourneysQueryless,
"SidePanelJourneysQueryless",
base::FEATURE_DISABLED_BY_DEFAULT);
#if !defined(ANDROID)
// This differs from the search companion by providing a separate WebUI that
// contains untrusted content in an iframe.
BASE_FEATURE(kSidePanelCompanion,
"SidePanelCompanion",
base::FEATURE_DISABLED_BY_DEFAULT);
constexpr base::FeatureParam<std::string> kHomepageURLForCompanion{
&kSidePanelCompanion, "companion-homepage-url", "https://www.example.com"};
#endif
// Enables tabs to scroll in the tabstrip. https://crbug.com/951078
BASE_FEATURE(kScrollableTabStrip,
"ScrollableTabStrip",
base::FEATURE_DISABLED_BY_DEFAULT);
const char kMinimumTabWidthFeatureParameterName[] = "minTabWidth";
// Enables buttons when scrolling the tabstrip https://crbug.com/951078
BASE_FEATURE(kTabScrollingButtonPosition,
"TabScrollingButtonPosition",
base::FEATURE_ENABLED_BY_DEFAULT);
const char kTabScrollingButtonPositionParameterName[] = "buttonPosition";
// Enables tab scrolling while dragging tabs in tabstrip
// https://crbug.com/1145747
BASE_FEATURE(kScrollableTabStripWithDragging,
"kScrollableTabStripWithDragging",
base::FEATURE_DISABLED_BY_DEFAULT);
const char kTabScrollingWithDraggingModeName[] = "tabScrollWithDragMode";
// Enables different methods of overflow when scrolling tabs in tabstrip
// https://crbug.com/951078
BASE_FEATURE(kScrollableTabStripOverflow,
"kScrollableTabStripOverflow",
base::FEATURE_DISABLED_BY_DEFAULT);
const char kScrollableTabStripOverflowModeName[] = "tabScrollOverflow";
// Splits pinned and unpinned tabs into separate TabStrips.
// https://crbug.com/1346019
BASE_FEATURE(kSplitTabStrip,
"SplitTabStrip",
base::FEATURE_DISABLED_BY_DEFAULT);
// Enables tabs to be frozen when collapsed.
// https://crbug.com/1110108
BASE_FEATURE(kTabGroupsCollapseFreezing,
"TabGroupsCollapseFreezing",
base::FEATURE_ENABLED_BY_DEFAULT);
// Directly controls the "new" badge (as opposed to old "master switch"; see
// https://crbug.com/1169907 for master switch deprecation and
// https://crbug.com/968587 for the feature itself)
// https://crbug.com/1173792
BASE_FEATURE(kTabGroupsNewBadgePromo,
"TabGroupsNewBadgePromo",
base::FEATURE_DISABLED_BY_DEFAULT);
// Enables users to explicitly save and recall tab groups.
// https://crbug.com/1223929
BASE_FEATURE(kTabGroupsSave,
"TabGroupsSave",
base::FEATURE_DISABLED_BY_DEFAULT);
// Enables users to explicitly save and recall tab groups.
// https://crbug.com/1223929
BASE_FEATURE(kTabGroupsSaveSyncIntegration,
"TabGroupsSaveSyncIntegration",
base::FEATURE_DISABLED_BY_DEFAULT);
// Enables preview images in tab-hover cards.
// https://crbug.com/928954
BASE_FEATURE(kTabHoverCardImages,
"TabHoverCardImages",
#if BUILDFLAG(IS_MAC)
base::FEATURE_DISABLED_BY_DEFAULT
#else
base::FEATURE_ENABLED_BY_DEFAULT
#endif
);
const char kTabHoverCardImagesNotReadyDelayParameterName[] =
"page_not_ready_delay";
const char kTabHoverCardImagesLoadingDelayParameterName[] =
"page_loading_delay";
const char kTabHoverCardImagesLoadedDelayParameterName[] = "page_loaded_delay";
const char kTabHoverCardImagesCrossfadePreviewAtParameterName[] =
"crossfade_preview_at";
const char kTabHoverCardAdditionalMaxWidthDelay[] =
"additional_max_width_delay";
const char kTabHoverCardAlternateFormat[] = "alternate_format";
BASE_FEATURE(kTabSearchChevronIcon,
"TabSearchChevronIcon",
base::FEATURE_ENABLED_BY_DEFAULT);
// Enables the tab search submit feedback button.
BASE_FEATURE(kTabSearchFeedback,
"TabSearchFeedback",
base::FEATURE_DISABLED_BY_DEFAULT);
// Controls whether or not to use fuzzy search for tab search.
BASE_FEATURE(kTabSearchFuzzySearch,
"TabSearchFuzzySearch",
base::FEATURE_DISABLED_BY_DEFAULT);
const char kTabSearchSearchThresholdName[] = "TabSearchSearchThreshold";
const base::FeatureParam<bool> kTabSearchSearchIgnoreLocation{
&kTabSearchFuzzySearch, "TabSearchSearchIgnoreLocation", false};
// If this feature parameter is enabled, show media tabs in both "Audio & Video"
// section and "Open Tabs" section.
const char kTabSearchAlsoShowMediaTabsinOpenTabsSectionParameterName[] =
"Also show Media Tabs in Open Tabs Section";
const base::FeatureParam<int> kTabSearchSearchDistance{
&kTabSearchFuzzySearch, "TabSearchSearchDistance", 200};
const base::FeatureParam<double> kTabSearchSearchThreshold{
&kTabSearchFuzzySearch, kTabSearchSearchThresholdName, 0.6};
const base::FeatureParam<double> kTabSearchTitleWeight{
&kTabSearchFuzzySearch, "TabSearchTitleWeight", 2.0};
const base::FeatureParam<double> kTabSearchHostnameWeight{
&kTabSearchFuzzySearch, "TabSearchHostnameWeight", 1.0};
const base::FeatureParam<double> kTabSearchGroupTitleWeight{
&kTabSearchFuzzySearch, "TabSearchGroupTitleWeight", 1.5};
const base::FeatureParam<bool> kTabSearchMoveActiveTabToBottom{
&kTabSearchFuzzySearch, "TabSearchMoveActiveTabToBottom", true};
// Controls feature parameters for Tab Search's `Recently Closed` entries.
BASE_FEATURE(kTabSearchRecentlyClosed,
"TabSearchRecentlyClosed",
base::FEATURE_ENABLED_BY_DEFAULT);
const base::FeatureParam<int> kTabSearchRecentlyClosedDefaultItemDisplayCount{
&kTabSearchRecentlyClosed, "TabSearchRecentlyClosedDefaultItemDisplayCount",
8};
const base::FeatureParam<int> kTabSearchRecentlyClosedTabCountThreshold{
&kTabSearchRecentlyClosed, "TabSearchRecentlyClosedTabCountThreshold", 100};
BASE_FEATURE(kTabSearchUseMetricsReporter,
"TabSearchUseMetricsReporter",
base::FEATURE_DISABLED_BY_DEFAULT);
BASE_FEATURE(kToolbarUseHardwareBitmapDraw,
"ToolbarUseHardwareBitmapDraw",
base::FEATURE_DISABLED_BY_DEFAULT);
// Controls whether top chrome pages will use the spare renderer if no top
// chrome renderers are present.
BASE_FEATURE(kTopChromeWebUIUsesSpareRenderer,
"TopChromeWebUIUsesSpareRenderer",
base::FEATURE_ENABLED_BY_DEFAULT);
// This enables enables persistence of a WebContents in a 1-to-1 association
// with the current Profile for WebUI bubbles. See https://crbug.com/1177048.
BASE_FEATURE(kWebUIBubblePerProfilePersistence,
"WebUIBubblePerProfilePersistence",
base::FEATURE_DISABLED_BY_DEFAULT);
// Enables a web-based tab strip. See https://crbug.com/989131. Note this
// feature only works when the ENABLE_WEBUI_TAB_STRIP buildflag is enabled.
BASE_FEATURE(kWebUITabStrip,
"WebUITabStrip",
#if BUILDFLAG(IS_CHROMEOS)
base::FEATURE_ENABLED_BY_DEFAULT
#else
base::FEATURE_DISABLED_BY_DEFAULT
#endif
);
// The default value of this flag is aligned with platform behavior to handle
// context menu with touch.
// TODO(crbug.com/1257626): Enable this flag for all platforms after launch.
BASE_FEATURE(kWebUITabStripContextMenuAfterTap,
"WebUITabStripContextMenuAfterTap",
#if BUILDFLAG(IS_CHROMEOS_ASH)
base::FEATURE_DISABLED_BY_DEFAULT
#else
base::FEATURE_ENABLED_BY_DEFAULT
#endif
);
#if BUILDFLAG(IS_CHROMEOS)
BASE_FEATURE(kChromeOSTabSearchCaptionButton,
"ChromeOSTabSearchCaptionButton",
base::FEATURE_DISABLED_BY_DEFAULT);
#endif
#if BUILDFLAG(IS_MAC)
// Enabled an experiment which increases the prominence to grant MacOS system
// location permission to Chrome when location permissions have already been
// approved. https://crbug.com/1211052
BASE_FEATURE(kLocationPermissionsExperiment,
"LocationPermissionsExperiment",
base::FEATURE_DISABLED_BY_DEFAULT);
constexpr base::FeatureParam<int>
kLocationPermissionsExperimentBubblePromptLimit{
&kLocationPermissionsExperiment, "bubble_prompt_count", 3};
constexpr base::FeatureParam<int>
kLocationPermissionsExperimentLabelPromptLimit{
&kLocationPermissionsExperiment, "label_prompt_count", 5};
BASE_FEATURE(kViewsFirstRunDialog,
"ViewsFirstRunDialog",
base::FEATURE_DISABLED_BY_DEFAULT);
BASE_FEATURE(kViewsTaskManager,
"ViewsTaskManager",
base::FEATURE_DISABLED_BY_DEFAULT);
BASE_FEATURE(kViewsJSAppModalDialog,
"ViewsJSAppModalDialog",
base::FEATURE_DISABLED_BY_DEFAULT);
int GetLocationPermissionsExperimentBubblePromptLimit() {
return kLocationPermissionsExperimentBubblePromptLimit.Get();
}
int GetLocationPermissionsExperimentLabelPromptLimit() {
return kLocationPermissionsExperimentLabelPromptLimit.Get();
}
#endif
#if BUILDFLAG(IS_WIN)
// Moves the Tab Search button into the browser frame's caption button area on
// Windows 10 (crbug.com/1223847).
BASE_FEATURE(kWin10TabSearchCaptionButton,
"Win10TabSearchCaptionButton",
base::FEATURE_ENABLED_BY_DEFAULT);
#endif
// Reduce resource usage when view is hidden by not rendering loading animation.
BASE_FEATURE(kStopLoadingAnimationForHiddenWindow,
"StopLoadingAnimationForHiddenWindow",
base::FEATURE_DISABLED_BY_DEFAULT);
} // namespace features