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