1 // Copyright 2017 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 #ifndef UI_BASE_UI_BASE_FEATURES_H_
6 #define UI_BASE_UI_BASE_FEATURES_H_
7 
8 #include "base/component_export.h"
9 #include "base/feature_list.h"
10 #include "build/build_config.h"
11 #include "ui/base/buildflags.h"
12 
13 namespace features {
14 
15 // Keep sorted!
16 
17 COMPONENT_EXPORT(UI_BASE_FEATURES)
18 extern const base::Feature kColorProviderRedirection;
19 COMPONENT_EXPORT(UI_BASE_FEATURES)
20 extern const base::Feature kCompositorThreadedScrollbarScrolling;
21 COMPONENT_EXPORT(UI_BASE_FEATURES)
22 extern const base::Feature kExperimentalFlingAnimation;
23 #if defined(OS_CHROMEOS)
24 COMPONENT_EXPORT(UI_BASE_FEATURES)
25 extern const base::Feature kSettingsShowsPerKeyboardSettings;
26 #endif  // defined(OS_CHROMEOS)
27 COMPONENT_EXPORT(UI_BASE_FEATURES)
28 extern const base::Feature kInputMethodSettingsUiUpdate;
29 COMPONENT_EXPORT(UI_BASE_FEATURES)
30 extern const base::Feature kPercentBasedScrolling;
31 COMPONENT_EXPORT(UI_BASE_FEATURES)
32 extern const base::Feature kPointerLockOptions;
33 COMPONENT_EXPORT(UI_BASE_FEATURES)
34 extern const base::Feature kSystemCaptionStyle;
35 COMPONENT_EXPORT(UI_BASE_FEATURES)
36 extern const base::Feature kSystemKeyboardLock;
37 COMPONENT_EXPORT(UI_BASE_FEATURES)
38 extern const base::Feature kNotificationIndicator;
39 COMPONENT_EXPORT(UI_BASE_FEATURES)
40 extern const base::Feature kUiCompositorScrollWithLayers;
41 
42 COMPONENT_EXPORT(UI_BASE_FEATURES) bool IsNotificationIndicatorEnabled();
43 
44 COMPONENT_EXPORT(UI_BASE_FEATURES) bool IsUiGpuRasterizationEnabled();
45 
46 #if defined(OS_WIN)
47 COMPONENT_EXPORT(UI_BASE_FEATURES)
48 extern const base::Feature kCalculateNativeWinOcclusion;
49 COMPONENT_EXPORT(UI_BASE_FEATURES)
50 extern const base::Feature kCalculateNativeWinOcclusionCheckVirtualDesktopUsed;
51 COMPONENT_EXPORT(UI_BASE_FEATURES)
52 extern const base::Feature kElasticOverscrollWin;
53 COMPONENT_EXPORT(UI_BASE_FEATURES)
54 extern const base::Feature kInputPaneOnScreenKeyboard;
55 COMPONENT_EXPORT(UI_BASE_FEATURES)
56 extern const base::Feature kPointerEventsForTouch;
57 COMPONENT_EXPORT(UI_BASE_FEATURES)
58 extern const base::Feature kPrecisionTouchpadLogging;
59 COMPONENT_EXPORT(UI_BASE_FEATURES) extern const base::Feature kTSFImeSupport;
60 
61 // Returns true if the system should use WM_POINTER events for touch events.
62 COMPONENT_EXPORT(UI_BASE_FEATURES) bool IsUsingWMPointerForTouch();
63 #endif  // defined(OS_WIN)
64 
65 #if defined(OS_WIN) || defined(OS_APPLE) || defined(OS_LINUX) || defined(OS_BSD) || \
66     defined(OS_CHROMEOS)
67 COMPONENT_EXPORT(UI_BASE_FEATURES)
68 extern const base::Feature kDirectManipulationStylus;
69 #endif  // defined(OS_WIN) || defined(OS_APPLE) || defined(OS_LINUX) || defined(OS_BSD) ||
70         // defined(OS_CHROMEOS)
71 
72 // Used to enable forced colors mode for web content.
73 COMPONENT_EXPORT(UI_BASE_FEATURES) extern const base::Feature kForcedColors;
74 COMPONENT_EXPORT(UI_BASE_FEATURES) bool IsForcedColorsEnabled();
75 
76 // Used to enable the eye-dropper in the refresh color-picker.
77 COMPONENT_EXPORT(UI_BASE_FEATURES) extern const base::Feature kEyeDropper;
78 COMPONENT_EXPORT(UI_BASE_FEATURES) bool IsEyeDropperEnabled();
79 
80 // Used to enable form controls and scrollbar dark mode rendering.
81 COMPONENT_EXPORT(UI_BASE_FEATURES)
82 extern const base::Feature kCSSColorSchemeUARendering;
83 COMPONENT_EXPORT(UI_BASE_FEATURES) bool IsCSSColorSchemeUARenderingEnabled();
84 
85 // Used to enable the new controls UI.
86 COMPONENT_EXPORT(UI_BASE_FEATURES)
87 extern const base::Feature kFormControlsRefresh;
88 COMPONENT_EXPORT(UI_BASE_FEATURES) bool IsFormControlsRefreshEnabled();
89 
90 // Used to enable the common select popup.
91 COMPONENT_EXPORT(UI_BASE_FEATURES)
92 extern const base::Feature kUseCommonSelectPopup;
93 COMPONENT_EXPORT(UI_BASE_FEATURES) bool IsUseCommonSelectPopupEnabled();
94 
95 #if defined(OS_CHROMEOS)
96 COMPONENT_EXPORT(UI_BASE_FEATURES)
97 extern const base::Feature kHandwritingGesture;
98 
99 COMPONENT_EXPORT(UI_BASE_FEATURES)
100 extern const base::Feature kNewShortcutMapping;
101 
102 COMPONENT_EXPORT(UI_BASE_FEATURES)
103 bool IsNewShortcutMappingEnabled();
104 #endif
105 
106 // Indicates whether DrmOverlayManager should used the synchronous API to
107 // perform pageflip tests.
108 COMPONENT_EXPORT(UI_BASE_FEATURES)
109 extern const base::Feature kSynchronousPageFlipTesting;
110 
111 COMPONENT_EXPORT(UI_BASE_FEATURES)
112 bool IsSynchronousPageFlipTestingEnabled();
113 
114 #if defined(USE_X11) || defined(USE_OZONE)
115 // Indicates whether the OzonePlatform feature is used on Linux. Although, it is
116 // available for all Ozone platforms, this always resolves to true for
117 // non-desktop Linux builds. The reason why it is needed for all Ozone builds is
118 // that we have many places in the code that Ozone takes independently of the
119 // platform, and it's highly important that when USE_X11 && USE_OZONE are true
120 // and the OzonePlatform feature is not enabled, the Ozone path is never taken.
121 // This will be removed as soon as Ozone/Linux is default and USE_X11 is
122 // removed.  More info at
123 // https://docs.google.com/document/d/1PvKquOHWySbvbe4bgduAcpW0Pda4BBhXI7xphtyDtPQ
124 COMPONENT_EXPORT(UI_BASE_FEATURES) extern const base::Feature kUseOzonePlatform;
125 
126 COMPONENT_EXPORT(UI_BASE_FEATURES) bool IsUsingOzonePlatform();
127 #endif
128 
129 // The type of predictor to use for the resampling events. These values are
130 // used as the 'predictor' feature param for
131 // |blink::features::kResamplingScrollEvents|.
132 COMPONENT_EXPORT(UI_BASE_FEATURES) extern const char kPredictorNameLsq[];
133 COMPONENT_EXPORT(UI_BASE_FEATURES) extern const char kPredictorNameKalman[];
134 COMPONENT_EXPORT(UI_BASE_FEATURES)
135 extern const char kPredictorNameLinearFirst[];
136 COMPONENT_EXPORT(UI_BASE_FEATURES)
137 extern const char kPredictorNameLinearSecond[];
138 COMPONENT_EXPORT(UI_BASE_FEATURES)
139 extern const char kPredictorNameLinearResampling[];
140 COMPONENT_EXPORT(UI_BASE_FEATURES) extern const char kPredictorNameEmpty[];
141 
142 // The type of filter to use for filtering events. These values are used as the
143 // 'filter' feature param for |blink::features::kFilteringScrollPrediction|.
144 COMPONENT_EXPORT(UI_BASE_FEATURES) extern const char kFilterNameEmpty[];
145 COMPONENT_EXPORT(UI_BASE_FEATURES) extern const char kFilterNameOneEuro[];
146 
147 // Android only feature, for swipe to move cursor.
148 COMPONENT_EXPORT(UI_BASE_FEATURES)
149 extern const base::Feature kSwipeToMoveCursor;
150 
151 COMPONENT_EXPORT(UI_BASE_FEATURES) bool IsSwipeToMoveCursorEnabled();
152 
153 }  // namespace features
154 
155 #endif  // UI_BASE_UI_BASE_FEATURES_H_
156