[chromedriver] Explicitly set page loading state when document.readyState != "complete".
[chromium-blink-merge.git] / chromeos / chromeos_switches.cc
blobbc1632607e6bb8cd9c371050b6fd81449f02813a
1 // Copyright (c) 2012 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.
5 #include "chromeos/chromeos_switches.h"
7 #include "base/command_line.h"
8 #include "base/metrics/field_trial.h"
10 // TODO(rsorokin): alphabetize all of these switches so they
11 // match the order from the .h file
13 namespace chromeos {
14 namespace switches {
16 // Allows remote attestation (RA) in dev mode for testing purpose. Usually RA
17 // is disabled in dev mode because it will always fail. However, there are cases
18 // in testing where we do want to go through the permission flow even in dev
19 // mode. This can be enabled by this flag.
20 const char kAllowRAInDevMode[] = "allow-ra-in-dev-mode";
22 // Path for app's OEM manifest file.
23 const char kAppOemManifestFile[] = "app-mode-oem-manifest";
25 // When wallpaper boot animation is not disabled this switch
26 // is used to override OOBE/sign in WebUI init type.
27 // Possible values: parallel|postpone. Default: parallel.
28 const char kAshWebUIInit[] = "ash-webui-init";
30 // Default wallpaper to use for kids accounts
31 // (as paths to trusted, non-user-writable JPEG files).
32 const char kChildWallpaperLarge[] = "child-wallpaper-large";
33 const char kChildWallpaperSmall[] = "child-wallpaper-small";
35 // Specifies the URL of the consumer device management backend.
36 const char kConsumerDeviceManagementUrl[] = "consumer-device-management-url";
38 // Forces the stub implementation of dbus clients.
39 const char kDbusStub[] = "dbus-stub";
41 // Comma-spearated list of dbus clients that should be unstubbed.
42 // See chromeos/dbus/dbus_client_bundle.cc for the names of the dbus clients.
43 const char kDbusUnstubClients[] = "dbus-unstub-clients";
45 // Indicates that the wallpaper images specified by
46 // kAshDefaultWallpaper{Large,Small} are OEM-specific (i.e. they are not
47 // downloadable from Google).
48 const char kDefaultWallpaperIsOem[] = "default-wallpaper-is-oem";
50 // Default wallpaper to use (as paths to trusted, non-user-writable JPEG files).
51 const char kDefaultWallpaperLarge[] = "default-wallpaper-large";
52 const char kDefaultWallpaperSmall[] = "default-wallpaper-small";
54 // Time before a machine at OOBE is considered derelict.
55 const char kDerelictDetectionTimeout[] = "derelict-detection-timeout";
57 // Time before a derelict machines starts demo mode.
58 const char kDerelictIdleTimeout[] = "derelict-idle-timeout";
60 // Disables wallpaper boot animation (except of OOBE case).
61 const char kDisableBootAnimation[] = "disable-boot-animation";
63 // Disables cloud backup feature.
64 const char kDisableCloudImport[] = "disable-cloud-import";
66 // Disables the ChromeOS demo.
67 const char kDisableDemoMode[] = "disable-demo-mode";
69 // Disable HID-detection OOBE screen.
70 const char kDisableHIDDetectionOnOOBE[] = "disable-hid-detection-on-oobe";
72 // Avoid doing expensive animations upon login.
73 const char kDisableLoginAnimations[] = "disable-login-animations";
75 // Disable new channel switcher UI.
76 const char kDisableNewChannelSwitcherUI[] = "disable-new-channel-switcher-ui";
78 // Disables new Kiosk UI when kiosk apps are represented as user pods.
79 const char kDisableNewKioskUI[] = "disable-new-kiosk-ui";
81 // Disables the new File System Provider API based ZIP unpacker.
82 const char kDisableNewZIPUnpacker[] = "disable-new-zip-unpacker";
84 // Disable Office Editing for Docs, Sheets & Slides component app so handlers
85 // won't be registered, making it possible to install another version for
86 // testing.
87 const char kDisableOfficeEditingComponentApp[] =
88 "disable-office-editing-component-extension";
90 // Disables rollback option on reset screen.
91 const char kDisableRollbackOption[] = "disable-rollback-option";
93 // Disables volume adjust sound.
94 const char kDisableVolumeAdjustSound[] = "disable-volume-adjust-sound";
96 // Disables wake on wifi features.
97 const char kDisableWakeOnWifi[] = "disable-wake-on-wifi";
99 // Disables notifications about captive portals in session.
100 const char kDisableNetworkPortalNotification[] =
101 "disable-network-portal-notification";
103 // EAFE url and path to use for Easy bootstrapping.
104 const char kEafeUrl[] = "eafe-url";
105 const char kEafePath[] = "eafe-path";
107 // Enables consumer management, which allows user to enroll, remotely lock and
108 // locate the device.
109 const char kEnableConsumerManagement[] = "enable-consumer-management";
111 // If this switch is set, the device cannot be remotely disabled by its owner.
112 const char kDisableDeviceDisabling[] = "disable-device-disabling";
114 // If this switch is set, the new Korean IME will not be available in
115 // chrome://settings/languages.
116 const char kDisableNewKoreanIme[] = "disable-new-korean-ime";
118 // Disables mtp write support.
119 const char kDisableMtpWriteSupport[] = "disable-mtp-write-support";
121 // If this switch is set, the options for suggestions as typing on physical
122 // keyboard will be enabled.
123 const char kEnablePhysicalKeyboardAutocorrect[] =
124 "enable-physical-keyboard-autocorrect";
126 // If this switch is set, the options for suggestions as typing on physical
127 // keyboard will be disabled.
128 const char kDisablePhysicalKeyboardAutocorrect[] =
129 "disable-physical-keyboard-autocorrect";
131 // Enabled sharing assets for installed default apps.
132 const char kEnableExtensionAssetsSharing[] = "enable-extension-assets-sharing";
134 // Enables notifications about captive portals in session.
135 const char kEnableNetworkPortalNotification[] =
136 "enable-network-portal-notification";
138 // Enables touchpad three-finger-click as middle button.
139 const char kEnableTouchpadThreeFingerClick[]
140 = "enable-touchpad-three-finger-click";
142 // Enables using screenshots in tests and seets mode.
143 const char kEnableScreenshotTestingWithMode[] =
144 "enable-screenshot-testing-with-mode";
146 // Enable Kiosk mode for ChromeOS. Note this switch refers to retail mode rather
147 // than the kiosk app mode.
148 const char kEnableKioskMode[] = "enable-kiosk-mode";
150 // Enables request of tablet site (via user agent override).
151 const char kEnableRequestTabletSite[] = "enable-request-tablet-site";
153 // Whether to enable forced enterprise re-enrollment.
154 const char kEnterpriseEnableForcedReEnrollment[] =
155 "enterprise-enable-forced-re-enrollment";
157 // Power of the power-of-2 initial modulus that will be used by the
158 // auto-enrollment client. E.g. "4" means the modulus will be 2^4 = 16.
159 const char kEnterpriseEnrollmentInitialModulus[] =
160 "enterprise-enrollment-initial-modulus";
162 // Power of the power-of-2 maximum modulus that will be used by the
163 // auto-enrollment client.
164 const char kEnterpriseEnrollmentModulusLimit[] =
165 "enterprise-enrollment-modulus-limit";
167 // Enables the chromecast support for video player app.
168 const char kEnableVideoPlayerChromecastSupport[] =
169 "enable-video-player-chromecast-support";
171 // Passed to Chrome the first time that it's run after the system boots.
172 // Not passed on restart after sign out.
173 const char kFirstExecAfterBoot[] = "first-exec-after-boot";
175 // Usually in browser tests the usual login manager bringup is skipped so that
176 // tests can change how it's brought up. This flag disables that.
177 const char kForceLoginManagerInTests[] = "force-login-manager-in-tests";
179 // Indicates that the browser is in "browse without sign-in" (Guest session)
180 // mode. Should completely disable extensions, sync and bookmarks.
181 const char kGuestSession[] = "bwsi";
183 // Wallpaper to use in guest mode (as paths to trusted, non-user-writable JPEG
184 // files).
185 const char kGuestWallpaperLarge[] = "guest-wallpaper-large";
186 const char kGuestWallpaperSmall[] = "guest-wallpaper-small";
188 // If true, the Chromebook has a Chrome OS keyboard. Don't use the flag for
189 // Chromeboxes.
190 const char kHasChromeOSKeyboard[] = "has-chromeos-keyboard";
192 // If true, the Chromebook has a keyboard with a diamond key.
193 const char kHasChromeOSDiamondKey[] = "has-chromeos-diamond-key";
195 // Defines user homedir. This defaults to primary user homedir.
196 const char kHomedir[] = "homedir";
198 // With this switch, start remora OOBE with the pairing screen.
199 const char kHostPairingOobe[] = "host-pairing-oobe";
201 // If true, profile selection in UserManager will always return active user's
202 // profile.
203 // TODO(nkostlyev): http://crbug.com/364604 - Get rid of this switch after we
204 // turn on multi-profile feature on ChromeOS.
205 const char kIgnoreUserProfileMappingForTests[] =
206 "ignore-user-profile-mapping-for-tests";
208 // File to load internal display ICC file from.
209 const char kInternalDisplayColorProfileFile[] =
210 "internal-display-color-profile-file";
212 // Enables Chrome-as-a-login-manager behavior.
213 const char kLoginManager[] = "login-manager";
215 // Specifies the profile to use once a chromeos user is logged in.
216 // This parameter is ignored if user goes through login screen since user_id
217 // hash defines which profile directory to use.
218 // In case of browser restart within active session this parameter is used
219 // to pass user_id hash for primary user.
220 const char kLoginProfile[] = "login-profile";
222 // Specifies the user which is already logged in.
223 const char kLoginUser[] = "login-user";
225 // The memory pressure thresholds selection which is used to decide whether and
226 // when a memory pressure event needs to get fired.
227 const char kMemoryPressureExperimentName[] = "ChromeOSMemoryPressureHandling";
228 const char kMemoryPressureHandlingOff[] = "memory-pressure-off";
229 const char kMemoryPressureThresholds[] = "memory-pressure-thresholds";
230 const char kConservativeThreshold[] = "conservative";
231 const char kAggressiveCacheDiscardThreshold[] = "aggressive-cache-discard";
232 const char kAggressiveTabDiscardThreshold[] = "aggressive-tab-discard";
233 const char kAggressiveThreshold[] = "aggressive";
235 // Enables natural scroll by default.
236 const char kNaturalScrollDefault[] = "enable-natural-scroll-default";
238 // Skips all other OOBE pages after user login.
239 const char kOobeSkipPostLogin[] = "oobe-skip-postlogin";
241 // Disable GAIA services such as enrollment and OAuth session restore. Used by
242 // 'fake' telemetry login.
243 const char kDisableGaiaServices[] = "disable-gaia-services";
245 // Interval at which we check for total time on OOBE.
246 const char kOobeTimerInterval[] = "oobe-timer-interval";
248 // Indicates that a guest session has been started before OOBE completion.
249 const char kOobeGuestSession[] = "oobe-guest-session";
251 // Specifies power stub behavior:
252 // 'cycle=2' - Cycles power states every 2 seconds.
253 // See FakeDBusThreadManager::ParsePowerCommandLineSwitch for full details.
254 const char kPowerStub[] = "power-stub";
256 // Overrides network stub behavior. By default, ethernet, wifi and vpn are
257 // enabled, and transitions occur instantaneously. Multiple options can be
258 // comma separated (no spaces). Note: all options are in the format 'foo=x'.
259 // Values are case sensitive and based on Shill names in service_constants.h.
260 // See FakeShillManagerClient::SetInitialNetworkState for implementation.
261 // Examples:
262 // 'clear=1' - Clears all default configurations
263 // 'wifi=on' - A wifi network is initially connected ('1' also works)
264 // 'wifi=off' - Wifi networks are all initially disconnected ('0' also works)
265 // 'wifi=disabled' - Wifi is initially disabled
266 // 'wifi=none' - Wifi is unavailable
267 // 'wifi=portal' - Wifi connection will be in Portal state
268 // 'cellular=1' - Cellular is initially connected
269 // 'cellular=LTE' - Cellular is initially connected, technology is LTE
270 // 'interactive=3' - Interactive mode, connect/scan/etc requests take 3 secs
271 const char kShillStub[] = "shill-stub";
273 // Sends test messages on first call to RequestUpdate (stub only).
274 const char kSmsTestMessages[] = "sms-test-messages";
276 // Indicates that a stub implementation of CrosSettings that stores settings in
277 // memory without signing should be used, treating current user as the owner.
278 // This also modifies OwnerSettingsServiceChromeOS::HandlesSetting such that no
279 // settings are handled by OwnerSettingsServiceChromeOS.
280 // This option is for testing the chromeos build of chrome on the desktop only.
281 const char kStubCrosSettings[] = "stub-cros-settings";
283 // Indicates that the system is running in dev mode. The dev mode probing is
284 // done by session manager.
285 const char kSystemDevMode[] = "system-developer-mode";
287 // Enables animated transitions during first-run tutorial.
288 const char kEnableFirstRunUITransitions[] = "enable-first-run-ui-transitions";
290 // Forces first-run UI to be shown for every login.
291 const char kForceFirstRunUI[] = "force-first-run-ui";
293 // Enables testing for auto update UI.
294 const char kTestAutoUpdateUI[] = "test-auto-update-ui";
296 // Enables waking the device based on the receipt of some network packets.
297 const char kWakeOnPackets[] = "wake-on-packets";
299 // Screenshot testing: specifies the directory where the golden screenshots are
300 // stored.
301 const char kGoldenScreenshotsDir[] = "golden-screenshots-dir";
303 // Screenshot testing: specifies the directoru where artifacts will be stored.
304 const char kArtifactsDir[] = "artifacts-dir";
306 // Disable bypass proxy for captive portal authorization.
307 const char kDisableCaptivePortalBypassProxy[] =
308 "disable-captive-portal-bypass-proxy";
310 // Disable automatic timezone update.
311 const char kDisableTimeZoneTrackingOption[] =
312 "disable-timezone-tracking-option";
314 // Switches and optional value for Data Saver prompt on cellular networks.
315 const char kDisableDataSaverPrompt[] = "disable-datasaver-prompt";
316 const char kEnableDataSaverPrompt[] = "enable-datasaver-prompt";
317 const char kDataSaverPromptDemoMode[] = "demo";
319 bool WakeOnWifiEnabled() {
320 return !base::CommandLine::ForCurrentProcess()->HasSwitch(kDisableWakeOnWifi);
323 bool MemoryPressureHandlingEnabled() {
324 if (base::FieldTrialList::FindFullName(kMemoryPressureExperimentName) ==
325 kMemoryPressureHandlingOff) {
326 return false;
328 return true;
331 base::chromeos::MemoryPressureMonitor::MemoryPressureThresholds
332 GetMemoryPressureThresholds() {
333 using MemoryPressureMonitor = base::chromeos::MemoryPressureMonitor;
335 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
336 kMemoryPressureThresholds)) {
337 const std::string group_name =
338 base::FieldTrialList::FindFullName(kMemoryPressureExperimentName);
339 if (group_name == kConservativeThreshold)
340 return MemoryPressureMonitor::THRESHOLD_CONSERVATIVE;
341 if (group_name == kAggressiveCacheDiscardThreshold)
342 return MemoryPressureMonitor::THRESHOLD_AGGRESSIVE_CACHE_DISCARD;
343 if (group_name == kAggressiveTabDiscardThreshold)
344 return MemoryPressureMonitor::THRESHOLD_AGGRESSIVE_TAB_DISCARD;
345 if (group_name == kAggressiveThreshold)
346 return MemoryPressureMonitor::THRESHOLD_AGGRESSIVE;
347 return MemoryPressureMonitor::THRESHOLD_DEFAULT;
350 const std::string option =
351 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
352 kMemoryPressureThresholds);
353 if (option == kConservativeThreshold)
354 return MemoryPressureMonitor::THRESHOLD_CONSERVATIVE;
355 if (option == kAggressiveCacheDiscardThreshold)
356 return MemoryPressureMonitor::THRESHOLD_AGGRESSIVE_CACHE_DISCARD;
357 if (option == kAggressiveTabDiscardThreshold)
358 return MemoryPressureMonitor::THRESHOLD_AGGRESSIVE_TAB_DISCARD;
359 if (option == kAggressiveThreshold)
360 return MemoryPressureMonitor::THRESHOLD_AGGRESSIVE;
362 return MemoryPressureMonitor::THRESHOLD_DEFAULT;
365 } // namespace switches
366 } // namespace chromeos