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
16 // Path for app's OEM manifest file.
17 const char kAppOemManifestFile
[] = "app-mode-oem-manifest";
19 // When wallpaper boot animation is not disabled this switch
20 // is used to override OOBE/sign in WebUI init type.
21 // Possible values: parallel|postpone. Default: parallel.
22 const char kAshWebUIInit
[] = "ash-webui-init";
24 // Default wallpaper to use for kids accounts
25 // (as paths to trusted, non-user-writable JPEG files).
26 const char kChildWallpaperLarge
[] = "child-wallpaper-large";
27 const char kChildWallpaperSmall
[] = "child-wallpaper-small";
29 // Specifies the URL of the consumer device management backend.
30 const char kConsumerDeviceManagementUrl
[] = "consumer-device-management-url";
32 // Forces the stub implementation of dbus clients.
33 const char kDbusStub
[] = "dbus-stub";
35 // Comma-spearated list of dbus clients that should be unstubbed.
36 // See chromeos/dbus/dbus_client_bundle.cc for the names of the dbus clients.
37 const char kDbusUnstubClients
[] = "dbus-unstub-clients";
39 // Indicates that the wallpaper images specified by
40 // kAshDefaultWallpaper{Large,Small} are OEM-specific (i.e. they are not
41 // downloadable from Google).
42 const char kDefaultWallpaperIsOem
[] = "default-wallpaper-is-oem";
44 // Default wallpaper to use (as paths to trusted, non-user-writable JPEG files).
45 const char kDefaultWallpaperLarge
[] = "default-wallpaper-large";
46 const char kDefaultWallpaperSmall
[] = "default-wallpaper-small";
48 // Time before a machine at OOBE is considered derelict.
49 const char kDerelictDetectionTimeout
[] = "derelict-detection-timeout";
51 // Time before a derelict machines starts demo mode.
52 const char kDerelictIdleTimeout
[] = "derelict-idle-timeout";
54 // Disables wallpaper boot animation (except of OOBE case).
55 const char kDisableBootAnimation
[] = "disable-boot-animation";
57 // Disables cloud backup feature.
58 const char kDisableCloudImport
[] = "disable-cloud-import";
60 // Disables the ChromeOS demo.
61 const char kDisableDemoMode
[] = "disable-demo-mode";
63 // Disable HID-detection OOBE screen.
64 const char kDisableHIDDetectionOnOOBE
[] = "disable-hid-detection-on-oobe";
66 // Avoid doing expensive animations upon login.
67 const char kDisableLoginAnimations
[] = "disable-login-animations";
69 // Disable login/lock UI (user pods) scrolling into view on JS side when virtual
71 const char kDisableLoginScrollIntoView
[] = "disable-login-scroll-into-view";
73 // Disable new channel switcher UI.
74 const char kDisableNewChannelSwitcherUI
[] = "disable-new-channel-switcher-ui";
76 // Disables new Kiosk UI when kiosk apps are represented as user pods.
77 const char kDisableNewKioskUI
[] = "disable-new-kiosk-ui";
79 // Disables the new File System Provider API based ZIP unpacker.
80 const char kDisableNewZIPUnpacker
[] = "disable-new-zip-unpacker";
82 // Disable Office Editing for Docs, Sheets & Slides component app so handlers
83 // won't be registered, making it possible to install another version for
85 const char kDisableOfficeEditingComponentApp
[] =
86 "disable-office-editing-component-extension";
88 // Disables rollback option on reset screen.
89 const char kDisableRollbackOption
[] = "disable-rollback-option";
91 // Disables volume adjust sound.
92 const char kDisableVolumeAdjustSound
[] = "disable-volume-adjust-sound";
94 // Disables wake on wifi features.
95 const char kDisableWakeOnWifi
[] = "disable-wake-on-wifi";
97 // Disables notifications about captive portals in session.
98 const char kDisableNetworkPortalNotification
[] =
99 "disable-network-portal-notification";
101 // Enables switching between different cellular carriers from the UI.
102 const char kEnableCarrierSwitching
[] = "enable-carrier-switching";
104 // Enables consumer management, which allows user to enroll, remotely lock and
105 // locate the device.
106 const char kEnableConsumerManagement
[] = "enable-consumer-management";
108 // If this switch is set, the device cannot be remotely disabled by its owner.
109 const char kDisableDeviceDisabling
[] = "disable-device-disabling";
111 // If this switch is set, Chrome OS login screen uses |EmbeddedSignin| endpoint
113 const char kEnableEmbeddedSignin
[] = "enable-embedded-signin";
115 // If this switch is set, the new Korean IME will be available in
116 // chrome://settings/languages.
117 const char kEnableNewKoreanIme
[] = "enable-new-korean-ime";
119 // If this switch is set, the input view keyboard will be in materia design.
120 const char kEnableNewMDInputView
[] = "enable-new-md-input-view";
122 // If this switch is set, the options for suggestions as typing on physical
123 // keyboard will be enabled.
124 const char kEnablePhysicalKeyboardAutocorrect
[] =
125 "enable-physical-keyboard-autocorrect";
127 // If this switch is set, the options for suggestions as typing on physical
128 // keyboard will be disabled.
129 const char kDisablePhysicalKeyboardAutocorrect
[] =
130 "disable-physical-keyboard-autocorrect";
132 // If this switch is set, the voice input will be disabled.
133 const char kDisableVoiceInput
[] = "disable-voice-input";
135 // Enabled sharing assets for installed default apps.
136 const char kEnableExtensionAssetsSharing
[] = "enable-extension-assets-sharing";
138 // Enables notifications about captive portals in session.
139 const char kEnableNetworkPortalNotification
[] =
140 "enable-network-portal-notification";
142 // Enables touchpad three-finger-click as middle button.
143 const char kEnableTouchpadThreeFingerClick
[]
144 = "enable-touchpad-three-finger-click";
146 // Enables using screenshots in tests and seets mode.
147 const char kEnableScreenshotTestingWithMode
[] =
148 "enable-screenshot-testing-with-mode";
150 // Enable Kiosk mode for ChromeOS. Note this switch refers to retail mode rather
151 // than the kiosk app mode.
152 const char kEnableKioskMode
[] = "enable-kiosk-mode";
154 // Enables request of tablet site (via user agent override).
155 const char kEnableRequestTabletSite
[] = "enable-request-tablet-site";
157 // Whether to enable forced enterprise re-enrollment.
158 const char kEnterpriseEnableForcedReEnrollment
[] =
159 "enterprise-enable-forced-re-enrollment";
161 // Power of the power-of-2 initial modulus that will be used by the
162 // auto-enrollment client. E.g. "4" means the modulus will be 2^4 = 16.
163 const char kEnterpriseEnrollmentInitialModulus
[] =
164 "enterprise-enrollment-initial-modulus";
166 // Power of the power-of-2 maximum modulus that will be used by the
167 // auto-enrollment client.
168 const char kEnterpriseEnrollmentModulusLimit
[] =
169 "enterprise-enrollment-modulus-limit";
171 // Don't create robot account on enrollment. Used when testing device
172 // enrollment against YAPS or the Python test server.
173 const char kEnterpriseEnrollmentSkipRobotAuth
[] =
174 "enterprise-enrollment-skip-robot-auth";
176 // Enables the chromecast support for video player app.
177 const char kEnableVideoPlayerChromecastSupport
[] =
178 "enable-video-player-chromecast-support";
180 // Passed to Chrome the first time that it's run after the system boots.
181 // Not passed on restart after sign out.
182 const char kFirstExecAfterBoot
[] = "first-exec-after-boot";
184 // Usually in browser tests the usual login manager bringup is skipped so that
185 // tests can change how it's brought up. This flag disables that.
186 const char kForceLoginManagerInTests
[] = "force-login-manager-in-tests";
188 // Indicates that the browser is in "browse without sign-in" (Guest session)
189 // mode. Should completely disable extensions, sync and bookmarks.
190 const char kGuestSession
[] = "bwsi";
192 // Wallpaper to use in guest mode (as paths to trusted, non-user-writable JPEG
194 const char kGuestWallpaperLarge
[] = "guest-wallpaper-large";
195 const char kGuestWallpaperSmall
[] = "guest-wallpaper-small";
197 // If true, the Chromebook has a Chrome OS keyboard. Don't use the flag for
199 const char kHasChromeOSKeyboard
[] = "has-chromeos-keyboard";
201 // If true, the Chromebook has a keyboard with a diamond key.
202 const char kHasChromeOSDiamondKey
[] = "has-chromeos-diamond-key";
204 // Defines user homedir. This defaults to primary user homedir.
205 const char kHomedir
[] = "homedir";
207 // With this switch, start remora OOBE with the pairing screen.
208 const char kHostPairingOobe
[] = "host-pairing-oobe";
210 // If true, profile selection in UserManager will always return active user's
212 // TODO(nkostlyev): http://crbug.com/364604 - Get rid of this switch after we
213 // turn on multi-profile feature on ChromeOS.
214 const char kIgnoreUserProfileMappingForTests
[] =
215 "ignore-user-profile-mapping-for-tests";
217 // Enables Chrome-as-a-login-manager behavior.
218 const char kLoginManager
[] = "login-manager";
220 // Specifies the profile to use once a chromeos user is logged in.
221 // This parameter is ignored if user goes through login screen since user_id
222 // hash defines which profile directory to use.
223 // In case of browser restart within active session this parameter is used
224 // to pass user_id hash for primary user.
225 const char kLoginProfile
[] = "login-profile";
227 // Specifies the user which is already logged in.
228 const char kLoginUser
[] = "login-user";
230 // The memory pressure thresholds selection which is used to decide whether and
231 // when a memory pressure event needs to get fired.
232 const char kMemoryPressureExperimentName
[] = "ChromeOSMemoryPressureHandling";
233 const char kMemoryPressureHandlingOff
[] = "memory-pressure-off";
234 const char kMemoryPressureThresholds
[] = "memory-pressure-thresholds";
235 const char kConservativeThreshold
[] = "conservative";
236 const char kAggressiveCacheDiscardThreshold
[] = "aggressive-cache-discard";
237 const char kAggressiveTabDiscardThreshold
[] = "aggressive-tab-discard";
238 const char kAggressiveThreshold
[] = "aggressive";
240 // Enables natural scroll by default.
241 const char kNaturalScrollDefault
[] = "enable-natural-scroll-default";
243 // Skips all other OOBE pages after user login.
244 const char kOobeSkipPostLogin
[] = "oobe-skip-postlogin";
246 // Disable GAIA services such as enrollment and OAuth session restore. Used by
247 // 'fake' telemetry login.
248 const char kDisableGaiaServices
[] = "disable-gaia-services";
250 // Interval at which we check for total time on OOBE.
251 const char kOobeTimerInterval
[] = "oobe-timer-interval";
253 // Indicates that a guest session has been started before OOBE completion.
254 const char kOobeGuestSession
[] = "oobe-guest-session";
256 // Specifies power stub behavior:
257 // 'cycle=2' - Cycles power states every 2 seconds.
258 // See FakeDBusThreadManager::ParsePowerCommandLineSwitch for full details.
259 const char kPowerStub
[] = "power-stub";
261 // Overrides network stub behavior. By default, ethernet, wifi and vpn are
262 // enabled, and transitions occur instantaneously. Multiple options can be
263 // comma separated (no spaces). Note: all options are in the format 'foo=x'.
264 // See FakeShillManagerClient::SetInitialNetworkState for implementation.
266 // 'clear=1' - Clears all default configurations
267 // 'wifi=on' - A wifi network is initially connected ('1' also works)
268 // 'wifi=off' - Wifi networks are all initially disconnected ('0' also works)
269 // 'wifi=disabled' - Wifi is initially disabled
270 // 'wifi=none' - Wifi is unavailable
271 // 'wifi=portal' - Wifi connection will be in Portal state
272 // 'cellular=1' - Cellular is initially connected
273 // 'interactive=3' - Interactive mode, connect/scan/etc requests take 3 secs
274 const char kShillStub
[] = "shill-stub";
276 // Sends test messages on first call to RequestUpdate (stub only).
277 const char kSmsTestMessages
[] = "sms-test-messages";
279 // Indicates that a stub implementation of CrosSettings that stores settings in
280 // memory without signing should be used, treating current user as the owner.
281 // This option is for testing the chromeos build of chrome on the desktop only.
282 const char kStubCrosSettings
[] = "stub-cros-settings";
284 // Indicates that the system is running in dev mode. The dev mode probing is
285 // done by session manager.
286 const char kSystemDevMode
[] = "system-developer-mode";
288 // Enables animated transitions during first-run tutorial.
289 const char kEnableFirstRunUITransitions
[] = "enable-first-run-ui-transitions";
291 // Forces first-run UI to be shown for every login.
292 const char kForceFirstRunUI
[] = "force-first-run-ui";
294 // Enables testing for auto update UI.
295 const char kTestAutoUpdateUI
[] = "test-auto-update-ui";
297 // Disable memory pressure checks on ChromeOS.
298 const char kDisableMemoryPressureSystemChromeOS
[] =
299 "disable-memory-pressure-chromeos";
301 // Enables waking the device based on the receipt of some network packets.
302 const char kWakeOnPackets
[] = "wake-on-packets";
304 // Specifies the path for GAIA endpoint. The default value is
305 // "ServiceLogin?skipvpage=true&sarp=1&rm=hide".
306 const char kGaiaEndpointChromeOS
[] = "gaia-endpoint-chromeos";
308 // Screenshot testing: specifies the directory where the golden screenshots are
310 const char kGoldenScreenshotsDir
[] = "golden-screenshots-dir";
312 // Screenshot testing: specifies the directoru where artifacts will be stored.
313 const char kArtifactsDir
[] = "artifacts-dir";
315 // Bypass proxy for captive portal authorization.
316 const char kEnableCaptivePortalBypassProxy
[] =
317 "enable-captive-portal-bypass-proxy";
319 // Disable automatic timezone update.
320 const char kDisableTimeZoneTrackingOption
[] =
321 "disable-timezone-tracking-option";
323 bool WakeOnWifiEnabled() {
324 return !base::CommandLine::ForCurrentProcess()->HasSwitch(kDisableWakeOnWifi
);
327 bool MemoryPressureHandlingEnabled() {
328 if ((base::CommandLine::ForCurrentProcess()->HasSwitch(
329 chromeos::switches::kDisableMemoryPressureSystemChromeOS
)) ||
330 (base::FieldTrialList::FindFullName(kMemoryPressureExperimentName
) ==
331 kMemoryPressureHandlingOff
))
336 base::MemoryPressureObserverChromeOS::MemoryPressureThresholds
337 GetMemoryPressureThresholds() {
338 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
339 kMemoryPressureThresholds
)) {
340 const std::string group_name
=
341 base::FieldTrialList::FindFullName(kMemoryPressureExperimentName
);
342 if (group_name
== kConservativeThreshold
)
343 return base::MemoryPressureObserverChromeOS::THRESHOLD_CONSERVATIVE
;
344 if (group_name
== kAggressiveCacheDiscardThreshold
)
345 return base::MemoryPressureObserverChromeOS::
346 THRESHOLD_AGGRESSIVE_CACHE_DISCARD
;
347 if (group_name
== kAggressiveTabDiscardThreshold
)
348 return base::MemoryPressureObserverChromeOS::
349 THRESHOLD_AGGRESSIVE_TAB_DISCARD
;
350 if (group_name
== kAggressiveThreshold
)
351 return base::MemoryPressureObserverChromeOS::THRESHOLD_AGGRESSIVE
;
352 return base::MemoryPressureObserverChromeOS::THRESHOLD_DEFAULT
;
355 const std::string option
=
356 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
357 kMemoryPressureThresholds
);
358 if (option
== kConservativeThreshold
)
359 return base::MemoryPressureObserverChromeOS::THRESHOLD_CONSERVATIVE
;
360 if (option
== kAggressiveCacheDiscardThreshold
)
361 return base::MemoryPressureObserverChromeOS::
362 THRESHOLD_AGGRESSIVE_CACHE_DISCARD
;
363 if (option
== kAggressiveTabDiscardThreshold
)
364 return base::MemoryPressureObserverChromeOS::
365 THRESHOLD_AGGRESSIVE_TAB_DISCARD
;
366 if (option
== kAggressiveThreshold
)
367 return base::MemoryPressureObserverChromeOS::THRESHOLD_AGGRESSIVE
;
369 return base::MemoryPressureObserverChromeOS::THRESHOLD_DEFAULT
;
372 } // namespace switches
373 } // namespace chromeos