[Session restore] Rename group name Enabled to Restore.
[chromium-blink-merge.git] / chromeos / chromeos_switches.cc
blobf1eea580c7f8878ebdcc1697698cde56021b0a59
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 login/lock UI (user pods) scrolling into view on JS side when virtual
76 // keyboard is shown.
77 const char kDisableLoginScrollIntoView[] = "disable-login-scroll-into-view";
79 // Disable new channel switcher UI.
80 const char kDisableNewChannelSwitcherUI[] = "disable-new-channel-switcher-ui";
82 // Disables new Kiosk UI when kiosk apps are represented as user pods.
83 const char kDisableNewKioskUI[] = "disable-new-kiosk-ui";
85 // Disables the new File System Provider API based ZIP unpacker.
86 const char kDisableNewZIPUnpacker[] = "disable-new-zip-unpacker";
88 // Disable Office Editing for Docs, Sheets & Slides component app so handlers
89 // won't be registered, making it possible to install another version for
90 // testing.
91 const char kDisableOfficeEditingComponentApp[] =
92 "disable-office-editing-component-extension";
94 // Disables rollback option on reset screen.
95 const char kDisableRollbackOption[] = "disable-rollback-option";
97 // Disables volume adjust sound.
98 const char kDisableVolumeAdjustSound[] = "disable-volume-adjust-sound";
100 // Disables wake on wifi features.
101 const char kDisableWakeOnWifi[] = "disable-wake-on-wifi";
103 // Disables notifications about captive portals in session.
104 const char kDisableNetworkPortalNotification[] =
105 "disable-network-portal-notification";
107 // EAFE url and path to use for Easy bootstrapping.
108 const char kEafeUrl[] = "eafe-url";
109 const char kEafePath[] = "eafe-path";
111 // Enables switching between different cellular carriers from the UI.
112 const char kEnableCarrierSwitching[] = "enable-carrier-switching";
114 // Enables consumer management, which allows user to enroll, remotely lock and
115 // locate the device.
116 const char kEnableConsumerManagement[] = "enable-consumer-management";
118 // If this switch is set, the device cannot be remotely disabled by its owner.
119 const char kDisableDeviceDisabling[] = "disable-device-disabling";
121 // If this switch is set, the new Korean IME will be available in
122 // chrome://settings/languages.
123 const char kEnableNewKoreanIme[] = "enable-new-korean-ime";
125 // If this switch is set, the input view keyboard will disable materia design.
126 const char kDisableNewMDInputView[] = "disable-new-md-input-view";
128 // If this switch is set, the options for suggestions as typing on physical
129 // keyboard will be enabled.
130 const char kEnablePhysicalKeyboardAutocorrect[] =
131 "enable-physical-keyboard-autocorrect";
133 // If this switch is set, the options for suggestions as typing on physical
134 // keyboard will be disabled.
135 const char kDisablePhysicalKeyboardAutocorrect[] =
136 "disable-physical-keyboard-autocorrect";
138 // If this switch is set, the voice input will be disabled.
139 const char kDisableVoiceInput[] = "disable-voice-input";
141 // Enabled sharing assets for installed default apps.
142 const char kEnableExtensionAssetsSharing[] = "enable-extension-assets-sharing";
144 // Enables mtp write support.
145 const char kEnableMtpWriteSupport[] = "enable-mtp-write-support";
147 // Enables notifications about captive portals in session.
148 const char kEnableNetworkPortalNotification[] =
149 "enable-network-portal-notification";
151 // Enables touchpad three-finger-click as middle button.
152 const char kEnableTouchpadThreeFingerClick[]
153 = "enable-touchpad-three-finger-click";
155 // Enables using screenshots in tests and seets mode.
156 const char kEnableScreenshotTestingWithMode[] =
157 "enable-screenshot-testing-with-mode";
159 // Enable Kiosk mode for ChromeOS. Note this switch refers to retail mode rather
160 // than the kiosk app mode.
161 const char kEnableKioskMode[] = "enable-kiosk-mode";
163 // Enables request of tablet site (via user agent override).
164 const char kEnableRequestTabletSite[] = "enable-request-tablet-site";
166 // Whether to enable forced enterprise re-enrollment.
167 const char kEnterpriseEnableForcedReEnrollment[] =
168 "enterprise-enable-forced-re-enrollment";
170 // Power of the power-of-2 initial modulus that will be used by the
171 // auto-enrollment client. E.g. "4" means the modulus will be 2^4 = 16.
172 const char kEnterpriseEnrollmentInitialModulus[] =
173 "enterprise-enrollment-initial-modulus";
175 // Power of the power-of-2 maximum modulus that will be used by the
176 // auto-enrollment client.
177 const char kEnterpriseEnrollmentModulusLimit[] =
178 "enterprise-enrollment-modulus-limit";
180 // Don't create robot account on enrollment. Used when testing device
181 // enrollment against YAPS or the Python test server.
182 const char kEnterpriseEnrollmentSkipRobotAuth[] =
183 "enterprise-enrollment-skip-robot-auth";
185 // Enables the chromecast support for video player app.
186 const char kEnableVideoPlayerChromecastSupport[] =
187 "enable-video-player-chromecast-support";
189 // Passed to Chrome the first time that it's run after the system boots.
190 // Not passed on restart after sign out.
191 const char kFirstExecAfterBoot[] = "first-exec-after-boot";
193 // Usually in browser tests the usual login manager bringup is skipped so that
194 // tests can change how it's brought up. This flag disables that.
195 const char kForceLoginManagerInTests[] = "force-login-manager-in-tests";
197 // Indicates that the browser is in "browse without sign-in" (Guest session)
198 // mode. Should completely disable extensions, sync and bookmarks.
199 const char kGuestSession[] = "bwsi";
201 // Wallpaper to use in guest mode (as paths to trusted, non-user-writable JPEG
202 // files).
203 const char kGuestWallpaperLarge[] = "guest-wallpaper-large";
204 const char kGuestWallpaperSmall[] = "guest-wallpaper-small";
206 // If true, the Chromebook has a Chrome OS keyboard. Don't use the flag for
207 // Chromeboxes.
208 const char kHasChromeOSKeyboard[] = "has-chromeos-keyboard";
210 // If true, the Chromebook has a keyboard with a diamond key.
211 const char kHasChromeOSDiamondKey[] = "has-chromeos-diamond-key";
213 // Defines user homedir. This defaults to primary user homedir.
214 const char kHomedir[] = "homedir";
216 // With this switch, start remora OOBE with the pairing screen.
217 const char kHostPairingOobe[] = "host-pairing-oobe";
219 // If true, profile selection in UserManager will always return active user's
220 // profile.
221 // TODO(nkostlyev): http://crbug.com/364604 - Get rid of this switch after we
222 // turn on multi-profile feature on ChromeOS.
223 const char kIgnoreUserProfileMappingForTests[] =
224 "ignore-user-profile-mapping-for-tests";
226 // Enables Chrome-as-a-login-manager behavior.
227 const char kLoginManager[] = "login-manager";
229 // Specifies the profile to use once a chromeos user is logged in.
230 // This parameter is ignored if user goes through login screen since user_id
231 // hash defines which profile directory to use.
232 // In case of browser restart within active session this parameter is used
233 // to pass user_id hash for primary user.
234 const char kLoginProfile[] = "login-profile";
236 // Specifies the user which is already logged in.
237 const char kLoginUser[] = "login-user";
239 // The memory pressure thresholds selection which is used to decide whether and
240 // when a memory pressure event needs to get fired.
241 const char kMemoryPressureExperimentName[] = "ChromeOSMemoryPressureHandling";
242 const char kMemoryPressureHandlingOff[] = "memory-pressure-off";
243 const char kMemoryPressureThresholds[] = "memory-pressure-thresholds";
244 const char kConservativeThreshold[] = "conservative";
245 const char kAggressiveCacheDiscardThreshold[] = "aggressive-cache-discard";
246 const char kAggressiveTabDiscardThreshold[] = "aggressive-tab-discard";
247 const char kAggressiveThreshold[] = "aggressive";
249 // Enables natural scroll by default.
250 const char kNaturalScrollDefault[] = "enable-natural-scroll-default";
252 // Skips all other OOBE pages after user login.
253 const char kOobeSkipPostLogin[] = "oobe-skip-postlogin";
255 // Disable GAIA services such as enrollment and OAuth session restore. Used by
256 // 'fake' telemetry login.
257 const char kDisableGaiaServices[] = "disable-gaia-services";
259 // Interval at which we check for total time on OOBE.
260 const char kOobeTimerInterval[] = "oobe-timer-interval";
262 // Indicates that a guest session has been started before OOBE completion.
263 const char kOobeGuestSession[] = "oobe-guest-session";
265 // Specifies power stub behavior:
266 // 'cycle=2' - Cycles power states every 2 seconds.
267 // See FakeDBusThreadManager::ParsePowerCommandLineSwitch for full details.
268 const char kPowerStub[] = "power-stub";
270 // Overrides network stub behavior. By default, ethernet, wifi and vpn are
271 // enabled, and transitions occur instantaneously. Multiple options can be
272 // comma separated (no spaces). Note: all options are in the format 'foo=x'.
273 // Values are case sensitive and based on Shill names in service_constants.h.
274 // See FakeShillManagerClient::SetInitialNetworkState for implementation.
275 // Examples:
276 // 'clear=1' - Clears all default configurations
277 // 'wifi=on' - A wifi network is initially connected ('1' also works)
278 // 'wifi=off' - Wifi networks are all initially disconnected ('0' also works)
279 // 'wifi=disabled' - Wifi is initially disabled
280 // 'wifi=none' - Wifi is unavailable
281 // 'wifi=portal' - Wifi connection will be in Portal state
282 // 'cellular=1' - Cellular is initially connected
283 // 'cellular=LTE' - Cellular is initially connected, technology is LTE
284 // 'interactive=3' - Interactive mode, connect/scan/etc requests take 3 secs
285 const char kShillStub[] = "shill-stub";
287 // Sends test messages on first call to RequestUpdate (stub only).
288 const char kSmsTestMessages[] = "sms-test-messages";
290 // Indicates that a stub implementation of CrosSettings that stores settings in
291 // memory without signing should be used, treating current user as the owner.
292 // This option is for testing the chromeos build of chrome on the desktop only.
293 const char kStubCrosSettings[] = "stub-cros-settings";
295 // Indicates that the system is running in dev mode. The dev mode probing is
296 // done by session manager.
297 const char kSystemDevMode[] = "system-developer-mode";
299 // Enables animated transitions during first-run tutorial.
300 const char kEnableFirstRunUITransitions[] = "enable-first-run-ui-transitions";
302 // Forces first-run UI to be shown for every login.
303 const char kForceFirstRunUI[] = "force-first-run-ui";
305 // Enables testing for auto update UI.
306 const char kTestAutoUpdateUI[] = "test-auto-update-ui";
308 // Enables testing Metronome client with a periodic timer.
309 const char kTestMetronomeTimer[] = "test-metronome-timer";
311 // Disable memory pressure checks on ChromeOS.
312 const char kDisableMemoryPressureSystemChromeOS[] =
313 "disable-memory-pressure-chromeos";
315 // Enables waking the device based on the receipt of some network packets.
316 const char kWakeOnPackets[] = "wake-on-packets";
318 // Screenshot testing: specifies the directory where the golden screenshots are
319 // stored.
320 const char kGoldenScreenshotsDir[] = "golden-screenshots-dir";
322 // Screenshot testing: specifies the directoru where artifacts will be stored.
323 const char kArtifactsDir[] = "artifacts-dir";
325 // Disable bypass proxy for captive portal authorization.
326 const char kDisableCaptivePortalBypassProxy[] =
327 "disable-captive-portal-bypass-proxy";
329 // Disable automatic timezone update.
330 const char kDisableTimeZoneTrackingOption[] =
331 "disable-timezone-tracking-option";
333 // Disable new GAIA sign-in flow.
334 const char kDisableWebviewSigninFlow[] = "disable-webview-signin-flow";
336 // Enable Chrome OS firewall hole-punching for Chrome Apps.
337 const char kEnableFirewallHolePunching[] = "enable-firewall-hole-punching";
339 // Enables searching for an app that supports a plugged in USB printer. When a
340 // user plugs in USB printer, they are shown a notification offering to search
341 // Chroem Web Store for an app that has printerProvider permission and can
342 // handle the plugged in printer.
343 const char kEnablePrinterAppSearch[] = "enable-printer-app-search";
345 // Switches and optional value for Data Saver prompt on cellular networks.
346 const char kDisableDataSaverPrompt[] = "disable-datasaver-prompt";
347 const char kEnableDataSaverPrompt[] = "enable-datasaver-prompt";
348 const char kDataSaverPromptDemoMode[] = "demo";
350 bool WakeOnWifiEnabled() {
351 return !base::CommandLine::ForCurrentProcess()->HasSwitch(kDisableWakeOnWifi);
354 bool MemoryPressureHandlingEnabled() {
355 if ((base::CommandLine::ForCurrentProcess()->HasSwitch(
356 chromeos::switches::kDisableMemoryPressureSystemChromeOS)) ||
357 (base::FieldTrialList::FindFullName(kMemoryPressureExperimentName) ==
358 kMemoryPressureHandlingOff))
359 return false;
360 return true;
363 base::MemoryPressureObserverChromeOS::MemoryPressureThresholds
364 GetMemoryPressureThresholds() {
365 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
366 kMemoryPressureThresholds)) {
367 const std::string group_name =
368 base::FieldTrialList::FindFullName(kMemoryPressureExperimentName);
369 if (group_name == kConservativeThreshold)
370 return base::MemoryPressureObserverChromeOS::THRESHOLD_CONSERVATIVE;
371 if (group_name == kAggressiveCacheDiscardThreshold)
372 return base::MemoryPressureObserverChromeOS::
373 THRESHOLD_AGGRESSIVE_CACHE_DISCARD;
374 if (group_name == kAggressiveTabDiscardThreshold)
375 return base::MemoryPressureObserverChromeOS::
376 THRESHOLD_AGGRESSIVE_TAB_DISCARD;
377 if (group_name == kAggressiveThreshold)
378 return base::MemoryPressureObserverChromeOS::THRESHOLD_AGGRESSIVE;
379 return base::MemoryPressureObserverChromeOS::THRESHOLD_DEFAULT;
382 const std::string option =
383 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
384 kMemoryPressureThresholds);
385 if (option == kConservativeThreshold)
386 return base::MemoryPressureObserverChromeOS::THRESHOLD_CONSERVATIVE;
387 if (option == kAggressiveCacheDiscardThreshold)
388 return base::MemoryPressureObserverChromeOS::
389 THRESHOLD_AGGRESSIVE_CACHE_DISCARD;
390 if (option == kAggressiveTabDiscardThreshold)
391 return base::MemoryPressureObserverChromeOS::
392 THRESHOLD_AGGRESSIVE_TAB_DISCARD;
393 if (option == kAggressiveThreshold)
394 return base::MemoryPressureObserverChromeOS::THRESHOLD_AGGRESSIVE;
396 return base::MemoryPressureObserverChromeOS::THRESHOLD_DEFAULT;
399 } // namespace switches
400 } // namespace chromeos