1 // Copyright 2018 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ash/public/cpp/ash_features.h"
6
7 #include "ash/public/cpp/ash_switches.h"
8 #include "base/command_line.h"
9 #include "base/feature_list.h"
10 #include "build/build_config.h"
11
12 namespace ash {
13 namespace features {
14
15 const base::Feature kAllowAmbientEQ{"AllowAmbientEQ",
16 base::FEATURE_DISABLED_BY_DEFAULT};
17
18 const base::Feature kAutoNightLight{"AutoNightLight",
19 base::FEATURE_DISABLED_BY_DEFAULT};
20
21 const base::Feature kCaptureMode{"CaptureMode",
22 base::FEATURE_DISABLED_BY_DEFAULT};
23
24 const base::Feature kContextualNudges{"ContextualNudges",
25 base::FEATURE_ENABLED_BY_DEFAULT};
26
27 const base::Feature kDarkLightMode{"DarkLightMode",
28 base::FEATURE_DISABLED_BY_DEFAULT};
29
30 const base::Feature kDesksRestore{"DesksRestore",
31 base::FEATURE_DISABLED_BY_DEFAULT};
32
33 const base::Feature kDisplayAlignAssist{"DisplayAlignAssist",
34 base::FEATURE_DISABLED_BY_DEFAULT};
35
36 const base::Feature kDisplayIdentification{"DisplayIdentification",
37 base::FEATURE_ENABLED_BY_DEFAULT};
38
39 const base::Feature kDockedMagnifier{"DockedMagnifier",
40 base::FEATURE_ENABLED_BY_DEFAULT};
41
42 const base::Feature kDragToSnapInClamshellMode{
43 "DragToSnapInClamshellMode", base::FEATURE_ENABLED_BY_DEFAULT};
44
45 const base::Feature kEnhancedDeskAnimations{"EnhancedDeskAnimations",
46 base::FEATURE_ENABLED_BY_DEFAULT};
47
48 const base::Feature kFullRestore{"FullRestore",
49 base::FEATURE_DISABLED_BY_DEFAULT};
50
51 const base::Feature kLimitAltTabToActiveDesk{"LimitAltTabToActiveDesk",
52 base::FEATURE_DISABLED_BY_DEFAULT};
53
54 const base::Feature kLockScreenNotifications{"LockScreenNotifications",
55 base::FEATURE_DISABLED_BY_DEFAULT};
56
57 const base::Feature kLockScreenInlineReply{"LockScreenInlineReply",
58 base::FEATURE_DISABLED_BY_DEFAULT};
59
60 const base::Feature kLockScreenHideSensitiveNotificationsSupport{
61 "LockScreenHideSensitiveNotificationsSupport",
62 base::FEATURE_DISABLED_BY_DEFAULT};
63
64 const base::Feature kLockScreenMediaControls{"LockScreenMediaControls",
65 base::FEATURE_ENABLED_BY_DEFAULT};
66
67 const base::Feature kHideArcMediaNotifications{
68 "HideArcMediaNotifications", base::FEATURE_ENABLED_BY_DEFAULT};
69
70 const base::Feature kInteractiveWindowCycleList{
71 "InteractiveWindowCycleList", base::FEATURE_ENABLED_BY_DEFAULT};
72
73 const base::Feature kManagedDeviceUIRedesign{"ManagedDeviceUIRedesign",
74 base::FEATURE_DISABLED_BY_DEFAULT};
75
76 const base::Feature kMediaSessionNotification{"MediaSessionNotification",
77 base::FEATURE_ENABLED_BY_DEFAULT};
78
79 const base::Feature kMediaNotificationsCounter{
80 "MediaNotificationsCounter", base::FEATURE_DISABLED_BY_DEFAULT};
81
82 const base::Feature kMovablePartialScreenshot{
83 "MovablePartialScreenshot", base::FEATURE_DISABLED_BY_DEFAULT};
84
85 const base::Feature kMultiDisplayOverviewAndSplitView{
86 "MultiDisplayOverviewAndSplitView", base::FEATURE_ENABLED_BY_DEFAULT};
87
88 const base::Feature kNightLight{"NightLight", base::FEATURE_ENABLED_BY_DEFAULT};
89
90 const base::Feature kNotificationExpansionAnimation{
91 "NotificationExpansionAnimation", base::FEATURE_DISABLED_BY_DEFAULT};
92
93 const base::Feature kNotificationExperimentalShortTimeouts{
94 "NotificationExperimentalShortTimeouts", base::FEATURE_ENABLED_BY_DEFAULT};
95
96 const base::Feature kNotificationScrollBar{"NotificationScrollBar",
97 base::FEATURE_DISABLED_BY_DEFAULT};
98
99 const base::Feature kPerDeskShelf{"PerDeskShelf",
100 base::FEATURE_DISABLED_BY_DEFAULT};
101
102 const base::Feature kPipRoundedCorners{"PipRoundedCorners",
103 base::FEATURE_DISABLED_BY_DEFAULT};
104
105 const base::Feature kReduceDisplayNotifications{
106 "ReduceDisplayNotifications", base::FEATURE_ENABLED_BY_DEFAULT};
107
108 const base::Feature kSeparateNetworkIcons{"SeparateNetworkIcons",
109 base::FEATURE_DISABLED_BY_DEFAULT};
110
111 const base::Feature kTrilinearFiltering{"TrilinearFiltering",
112 base::FEATURE_DISABLED_BY_DEFAULT};
113
114 const base::Feature kUseBluetoothSystemInAsh{"UseBluetoothSystemInAsh",
115 base::FEATURE_DISABLED_BY_DEFAULT};
116
117 const base::Feature kSwapSideVolumeButtonsForOrientation{
118 "SwapSideVolumeButtonsForOrientation", base::FEATURE_ENABLED_BY_DEFAULT};
119
120 const base::Feature kEnableBackgroundBlur{"EnableBackgroundBlur",
121 base::FEATURE_ENABLED_BY_DEFAULT};
122
123 const base::Feature kHideShelfControlsInTabletMode{
124 "HideShelfControlsInTabletMode", base::FEATURE_ENABLED_BY_DEFAULT};
125
126 const base::Feature kReverseScrollGestures{"EnableReverseScrollGestures",
127 base::FEATURE_ENABLED_BY_DEFAULT};
128
129 const base::Feature kFullscreenAlertBubble{"EnableFullscreenBubble",
130 base::FEATURE_DISABLED_BY_DEFAULT};
131
132 const base::Feature kSystemTrayMicGainSetting{"SystemTrayMicGainSetting",
133 base::FEATURE_ENABLED_BY_DEFAULT};
134
135 const base::Feature kWebUITabStripTabDragIntegration{
136 "WebUITabStripTabDragIntegration", base::FEATURE_DISABLED_BY_DEFAULT};
137
138 const base::Feature kNotificationsInContextMenu{
139 "NotificationsInContextMenu", base::FEATURE_DISABLED_BY_DEFAULT};
140
141 const base::Feature kTemporaryHoldingSpace{"TemporaryHoldingSpace",
142 base::FEATURE_DISABLED_BY_DEFAULT};
143
144 const base::Feature kTemporaryHoldingSpacePreviews{
145 "TemporaryHoldingSpacePreviews", base::FEATURE_DISABLED_BY_DEFAULT};
146
147 const base::Feature kDragUnpinnedAppToPin{"DragUnpinnedAppToPin",
148 base::FEATURE_DISABLED_BY_DEFAULT};
149
IsAllowAmbientEQEnabled()150 bool IsAllowAmbientEQEnabled() {
151 return base::FeatureList::IsEnabled(kAllowAmbientEQ);
152 }
153
IsAltTabLimitedToActiveDesk()154 bool IsAltTabLimitedToActiveDesk() {
155 return base::FeatureList::IsEnabled(kLimitAltTabToActiveDesk);
156 }
157
IsPerDeskShelfEnabled()158 bool IsPerDeskShelfEnabled() {
159 return base::FeatureList::IsEnabled(kPerDeskShelf);
160 }
161
IsAutoNightLightEnabled()162 bool IsAutoNightLightEnabled() {
163 return base::FeatureList::IsEnabled(kAutoNightLight);
164 }
165
IsCaptureModeEnabled()166 bool IsCaptureModeEnabled() {
167 return base::FeatureList::IsEnabled(kCaptureMode);
168 }
169
IsDarkLightModeEnabled()170 bool IsDarkLightModeEnabled() {
171 return base::FeatureList::IsEnabled(kDarkLightMode);
172 }
173
IsEnhancedDeskAnimations()174 bool IsEnhancedDeskAnimations() {
175 return base::FeatureList::IsEnabled(kEnhancedDeskAnimations);
176 }
177
IsFullRestoreEnabled()178 bool IsFullRestoreEnabled() {
179 return base::FeatureList::IsEnabled(kFullRestore);
180 }
181
IsHideArcMediaNotificationsEnabled()182 bool IsHideArcMediaNotificationsEnabled() {
183 return base::FeatureList::IsEnabled(kMediaSessionNotification) &&
184 base::FeatureList::IsEnabled(kHideArcMediaNotifications);
185 }
186
IsLockScreenNotificationsEnabled()187 bool IsLockScreenNotificationsEnabled() {
188 return base::FeatureList::IsEnabled(kLockScreenNotifications);
189 }
190
IsLockScreenInlineReplyEnabled()191 bool IsLockScreenInlineReplyEnabled() {
192 return base::FeatureList::IsEnabled(kLockScreenInlineReply);
193 }
194
IsLockScreenHideSensitiveNotificationsSupported()195 bool IsLockScreenHideSensitiveNotificationsSupported() {
196 return base::FeatureList::IsEnabled(
197 kLockScreenHideSensitiveNotificationsSupport);
198 }
199
IsInteractiveWindowCycleListEnabled()200 bool IsInteractiveWindowCycleListEnabled() {
201 return base::FeatureList::IsEnabled(kInteractiveWindowCycleList);
202 }
203
IsManagedDeviceUIRedesignEnabled()204 bool IsManagedDeviceUIRedesignEnabled() {
205 return base::FeatureList::IsEnabled(kManagedDeviceUIRedesign);
206 }
207
IsNotificationExpansionAnimationEnabled()208 bool IsNotificationExpansionAnimationEnabled() {
209 return base::FeatureList::IsEnabled(kNotificationExpansionAnimation);
210 }
211
IsNotificationScrollBarEnabled()212 bool IsNotificationScrollBarEnabled() {
213 return base::FeatureList::IsEnabled(kNotificationScrollBar);
214 }
215
IsNotificationExperimentalShortTimeoutsEnabled()216 bool IsNotificationExperimentalShortTimeoutsEnabled() {
217 return base::FeatureList::IsEnabled(kNotificationExperimentalShortTimeouts);
218 }
219
IsPipRoundedCornersEnabled()220 bool IsPipRoundedCornersEnabled() {
221 return base::FeatureList::IsEnabled(kPipRoundedCorners);
222 }
223
IsDesksRestoreEnabled()224 bool IsDesksRestoreEnabled() {
225 return base::FeatureList::IsEnabled(kDesksRestore);
226 }
227
IsSeparateNetworkIconsEnabled()228 bool IsSeparateNetworkIconsEnabled() {
229 return base::FeatureList::IsEnabled(kSeparateNetworkIcons);
230 }
231
IsTrilinearFilteringEnabled()232 bool IsTrilinearFilteringEnabled() {
233 static bool use_trilinear_filtering =
234 base::FeatureList::IsEnabled(kTrilinearFiltering);
235 return use_trilinear_filtering;
236 }
237
IsSwapSideVolumeButtonsForOrientationEnabled()238 bool IsSwapSideVolumeButtonsForOrientationEnabled() {
239 return base::FeatureList::IsEnabled(kSwapSideVolumeButtonsForOrientation);
240 }
241
IsBackgroundBlurEnabled()242 bool IsBackgroundBlurEnabled() {
243 bool enabled_by_feature_flag =
244 base::FeatureList::IsEnabled(kEnableBackgroundBlur);
245 #if defined(ARCH_CPU_ARM_FAMILY)
246 // Enable background blur on Mali when GPU rasterization is enabled.
247 // See crbug.com/996858 for the condition.
248 return enabled_by_feature_flag &&
249 base::CommandLine::ForCurrentProcess()->HasSwitch(
250 ash::switches::kAshEnableTabletMode);
251 #else
252 return enabled_by_feature_flag;
253 #endif
254 }
255
IsReduceDisplayNotificationsEnabled()256 bool IsReduceDisplayNotificationsEnabled() {
257 return base::FeatureList::IsEnabled(kReduceDisplayNotifications);
258 }
259
IsHideShelfControlsInTabletModeEnabled()260 bool IsHideShelfControlsInTabletModeEnabled() {
261 return base::FeatureList::IsEnabled(kHideShelfControlsInTabletMode);
262 }
263
IsReverseScrollGesturesEnabled()264 bool IsReverseScrollGesturesEnabled() {
265 return base::FeatureList::IsEnabled(kReverseScrollGestures);
266 }
267
IsFullscreenAlertBubbleEnabled()268 bool IsFullscreenAlertBubbleEnabled() {
269 return base::FeatureList::IsEnabled(kFullscreenAlertBubble);
270 }
271
AreContextualNudgesEnabled()272 bool AreContextualNudgesEnabled() {
273 if (!IsHideShelfControlsInTabletModeEnabled())
274 return false;
275 return base::FeatureList::IsEnabled(kContextualNudges);
276 }
277
IsSystemTrayMicGainSettingEnabled()278 bool IsSystemTrayMicGainSettingEnabled() {
279 return base::FeatureList::IsEnabled(kSystemTrayMicGainSetting);
280 }
281
IsDisplayIdentificationEnabled()282 bool IsDisplayIdentificationEnabled() {
283 return base::FeatureList::IsEnabled(kDisplayIdentification);
284 }
285
IsWebUITabStripTabDragIntegrationEnabled()286 bool IsWebUITabStripTabDragIntegrationEnabled() {
287 return base::FeatureList::IsEnabled(kWebUITabStripTabDragIntegration);
288 }
289
IsDisplayAlignmentAssistanceEnabled()290 bool IsDisplayAlignmentAssistanceEnabled() {
291 return base::FeatureList::IsEnabled(kDisplayAlignAssist);
292 }
293
IsMovablePartialScreenshotEnabled()294 bool IsMovablePartialScreenshotEnabled() {
295 return base::FeatureList::IsEnabled(kMovablePartialScreenshot);
296 }
297
IsNotificationsInContextMenuEnabled()298 bool IsNotificationsInContextMenuEnabled() {
299 return base::FeatureList::IsEnabled(kNotificationsInContextMenu);
300 }
301
IsTemporaryHoldingSpaceEnabled()302 bool IsTemporaryHoldingSpaceEnabled() {
303 return base::FeatureList::IsEnabled(kTemporaryHoldingSpace);
304 }
305
IsTemporaryHoldingSpacePreviewsEnabled()306 bool IsTemporaryHoldingSpacePreviewsEnabled() {
307 return base::FeatureList::IsEnabled(kTemporaryHoldingSpace) &&
308 base::FeatureList::IsEnabled(kTemporaryHoldingSpacePreviews);
309 }
310
IsDragUnpinnedAppToPinEnabled()311 bool IsDragUnpinnedAppToPinEnabled() {
312 return base::FeatureList::IsEnabled(kDragUnpinnedAppToPin);
313 }
314
315 namespace {
316
317 // The boolean flag indicating if "WebUITabStrip" feature is enabled in Chrome.
318 bool g_webui_tab_strip_enabled = false;
319
320 } // namespace
321
SetWebUITabStripEnabled(bool enabled)322 void SetWebUITabStripEnabled(bool enabled) {
323 g_webui_tab_strip_enabled = enabled;
324 }
325
IsWebUITabStripEnabled()326 bool IsWebUITabStripEnabled() {
327 return g_webui_tab_strip_enabled;
328 }
329
330 } // namespace features
331 } // namespace ash
332