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 // EAFE url and path to use for Easy bootstrapping.
102 const char kEafeUrl
[] = "eafe-url";
103 const char kEafePath
[] = "eafe-path";
105 // Enables switching between different cellular carriers from the UI.
106 const char kEnableCarrierSwitching
[] = "enable-carrier-switching";
108 // Enables consumer management, which allows user to enroll, remotely lock and
109 // locate the device.
110 const char kEnableConsumerManagement
[] = "enable-consumer-management";
112 // If this switch is set, the device cannot be remotely disabled by its owner.
113 const char kDisableDeviceDisabling
[] = "disable-device-disabling";
115 // If this switch is set, Chrome OS login screen uses |EmbeddedSignin| endpoint
117 const char kEnableEmbeddedSignin
[] = "enable-embedded-signin";
119 // If this switch is set, the new Korean IME will be available in
120 // chrome://settings/languages.
121 const char kEnableNewKoreanIme
[] = "enable-new-korean-ime";
123 // If this switch is set, the input view keyboard will be in materia design.
124 const char kEnableNewMDInputView
[] = "enable-new-md-input-view";
126 // If this switch is set, the options for suggestions as typing on physical
127 // keyboard will be enabled.
128 const char kEnablePhysicalKeyboardAutocorrect
[] =
129 "enable-physical-keyboard-autocorrect";
131 // If this switch is set, the options for suggestions as typing on physical
132 // keyboard will be disabled.
133 const char kDisablePhysicalKeyboardAutocorrect
[] =
134 "disable-physical-keyboard-autocorrect";
136 // If this switch is set, the voice input will be disabled.
137 const char kDisableVoiceInput
[] = "disable-voice-input";
139 // Enabled sharing assets for installed default apps.
140 const char kEnableExtensionAssetsSharing
[] = "enable-extension-assets-sharing";
142 // Enables notifications about captive portals in session.
143 const char kEnableNetworkPortalNotification
[] =
144 "enable-network-portal-notification";
146 // Enables touchpad three-finger-click as middle button.
147 const char kEnableTouchpadThreeFingerClick
[]
148 = "enable-touchpad-three-finger-click";
150 // Enables using screenshots in tests and seets mode.
151 const char kEnableScreenshotTestingWithMode
[] =
152 "enable-screenshot-testing-with-mode";
154 // Enable Kiosk mode for ChromeOS. Note this switch refers to retail mode rather
155 // than the kiosk app mode.
156 const char kEnableKioskMode
[] = "enable-kiosk-mode";
158 // Enables request of tablet site (via user agent override).
159 const char kEnableRequestTabletSite
[] = "enable-request-tablet-site";
161 // Whether to enable forced enterprise re-enrollment.
162 const char kEnterpriseEnableForcedReEnrollment
[] =
163 "enterprise-enable-forced-re-enrollment";
165 // Power of the power-of-2 initial modulus that will be used by the
166 // auto-enrollment client. E.g. "4" means the modulus will be 2^4 = 16.
167 const char kEnterpriseEnrollmentInitialModulus
[] =
168 "enterprise-enrollment-initial-modulus";
170 // Power of the power-of-2 maximum modulus that will be used by the
171 // auto-enrollment client.
172 const char kEnterpriseEnrollmentModulusLimit
[] =
173 "enterprise-enrollment-modulus-limit";
175 // Don't create robot account on enrollment. Used when testing device
176 // enrollment against YAPS or the Python test server.
177 const char kEnterpriseEnrollmentSkipRobotAuth
[] =
178 "enterprise-enrollment-skip-robot-auth";
180 // Enables the chromecast support for video player app.
181 const char kEnableVideoPlayerChromecastSupport
[] =
182 "enable-video-player-chromecast-support";
184 // Passed to Chrome the first time that it's run after the system boots.
185 // Not passed on restart after sign out.
186 const char kFirstExecAfterBoot
[] = "first-exec-after-boot";
188 // Usually in browser tests the usual login manager bringup is skipped so that
189 // tests can change how it's brought up. This flag disables that.
190 const char kForceLoginManagerInTests
[] = "force-login-manager-in-tests";
192 // Indicates that the browser is in "browse without sign-in" (Guest session)
193 // mode. Should completely disable extensions, sync and bookmarks.
194 const char kGuestSession
[] = "bwsi";
196 // Wallpaper to use in guest mode (as paths to trusted, non-user-writable JPEG
198 const char kGuestWallpaperLarge
[] = "guest-wallpaper-large";
199 const char kGuestWallpaperSmall
[] = "guest-wallpaper-small";
201 // If true, the Chromebook has a Chrome OS keyboard. Don't use the flag for
203 const char kHasChromeOSKeyboard
[] = "has-chromeos-keyboard";
205 // If true, the Chromebook has a keyboard with a diamond key.
206 const char kHasChromeOSDiamondKey
[] = "has-chromeos-diamond-key";
208 // Defines user homedir. This defaults to primary user homedir.
209 const char kHomedir
[] = "homedir";
211 // With this switch, start remora OOBE with the pairing screen.
212 const char kHostPairingOobe
[] = "host-pairing-oobe";
214 // If true, profile selection in UserManager will always return active user's
216 // TODO(nkostlyev): http://crbug.com/364604 - Get rid of this switch after we
217 // turn on multi-profile feature on ChromeOS.
218 const char kIgnoreUserProfileMappingForTests
[] =
219 "ignore-user-profile-mapping-for-tests";
221 // Enables Chrome-as-a-login-manager behavior.
222 const char kLoginManager
[] = "login-manager";
224 // Specifies the profile to use once a chromeos user is logged in.
225 // This parameter is ignored if user goes through login screen since user_id
226 // hash defines which profile directory to use.
227 // In case of browser restart within active session this parameter is used
228 // to pass user_id hash for primary user.
229 const char kLoginProfile
[] = "login-profile";
231 // Specifies the user which is already logged in.
232 const char kLoginUser
[] = "login-user";
234 // The memory pressure thresholds selection which is used to decide whether and
235 // when a memory pressure event needs to get fired.
236 const char kMemoryPressureExperimentName
[] = "ChromeOSMemoryPressureHandling";
237 const char kMemoryPressureHandlingOff
[] = "memory-pressure-off";
238 const char kMemoryPressureThresholds
[] = "memory-pressure-thresholds";
239 const char kConservativeThreshold
[] = "conservative";
240 const char kAggressiveCacheDiscardThreshold
[] = "aggressive-cache-discard";
241 const char kAggressiveTabDiscardThreshold
[] = "aggressive-tab-discard";
242 const char kAggressiveThreshold
[] = "aggressive";
244 // Enables natural scroll by default.
245 const char kNaturalScrollDefault
[] = "enable-natural-scroll-default";
247 // Skips all other OOBE pages after user login.
248 const char kOobeSkipPostLogin
[] = "oobe-skip-postlogin";
250 // Disable GAIA services such as enrollment and OAuth session restore. Used by
251 // 'fake' telemetry login.
252 const char kDisableGaiaServices
[] = "disable-gaia-services";
254 // Interval at which we check for total time on OOBE.
255 const char kOobeTimerInterval
[] = "oobe-timer-interval";
257 // Indicates that a guest session has been started before OOBE completion.
258 const char kOobeGuestSession
[] = "oobe-guest-session";
260 // Specifies power stub behavior:
261 // 'cycle=2' - Cycles power states every 2 seconds.
262 // See FakeDBusThreadManager::ParsePowerCommandLineSwitch for full details.
263 const char kPowerStub
[] = "power-stub";
265 // Overrides network stub behavior. By default, ethernet, wifi and vpn are
266 // enabled, and transitions occur instantaneously. Multiple options can be
267 // comma separated (no spaces). Note: all options are in the format 'foo=x'.
268 // Values are case sensitive and based on Shill names in service_constants.h.
269 // See FakeShillManagerClient::SetInitialNetworkState for implementation.
271 // 'clear=1' - Clears all default configurations
272 // 'wifi=on' - A wifi network is initially connected ('1' also works)
273 // 'wifi=off' - Wifi networks are all initially disconnected ('0' also works)
274 // 'wifi=disabled' - Wifi is initially disabled
275 // 'wifi=none' - Wifi is unavailable
276 // 'wifi=portal' - Wifi connection will be in Portal state
277 // 'cellular=1' - Cellular is initially connected
278 // 'cellular=LTE' - Cellular is initially connected, technology is LTE
279 // 'interactive=3' - Interactive mode, connect/scan/etc requests take 3 secs
280 const char kShillStub
[] = "shill-stub";
282 // Sends test messages on first call to RequestUpdate (stub only).
283 const char kSmsTestMessages
[] = "sms-test-messages";
285 // Indicates that a stub implementation of CrosSettings that stores settings in
286 // memory without signing should be used, treating current user as the owner.
287 // This option is for testing the chromeos build of chrome on the desktop only.
288 const char kStubCrosSettings
[] = "stub-cros-settings";
290 // Indicates that the system is running in dev mode. The dev mode probing is
291 // done by session manager.
292 const char kSystemDevMode
[] = "system-developer-mode";
294 // Enables animated transitions during first-run tutorial.
295 const char kEnableFirstRunUITransitions
[] = "enable-first-run-ui-transitions";
297 // Forces first-run UI to be shown for every login.
298 const char kForceFirstRunUI
[] = "force-first-run-ui";
300 // Enables testing for auto update UI.
301 const char kTestAutoUpdateUI
[] = "test-auto-update-ui";
303 // Enables testing Metronome client with a periodic timer.
304 const char kTestMetronomeTimer
[] = "test-metronome-timer";
306 // Disable memory pressure checks on ChromeOS.
307 const char kDisableMemoryPressureSystemChromeOS
[] =
308 "disable-memory-pressure-chromeos";
310 // Enables waking the device based on the receipt of some network packets.
311 const char kWakeOnPackets
[] = "wake-on-packets";
313 // Specifies the path for GAIA endpoint. The default value is
314 // "ServiceLogin?skipvpage=true&sarp=1&rm=hide".
315 const char kGaiaEndpointChromeOS
[] = "gaia-endpoint-chromeos";
317 // Screenshot testing: specifies the directory where the golden screenshots are
319 const char kGoldenScreenshotsDir
[] = "golden-screenshots-dir";
321 // Screenshot testing: specifies the directoru where artifacts will be stored.
322 const char kArtifactsDir
[] = "artifacts-dir";
324 // Bypass proxy for captive portal authorization.
325 const char kEnableCaptivePortalBypassProxyOption
[] =
326 "enable-captive-portal-bypass-proxy-option";
328 // Disable automatic timezone update.
329 const char kDisableTimeZoneTrackingOption
[] =
330 "disable-timezone-tracking-option";
332 bool WakeOnWifiEnabled() {
333 return !base::CommandLine::ForCurrentProcess()->HasSwitch(kDisableWakeOnWifi
);
336 bool MemoryPressureHandlingEnabled() {
337 if ((base::CommandLine::ForCurrentProcess()->HasSwitch(
338 chromeos::switches::kDisableMemoryPressureSystemChromeOS
)) ||
339 (base::FieldTrialList::FindFullName(kMemoryPressureExperimentName
) ==
340 kMemoryPressureHandlingOff
))
345 base::MemoryPressureObserverChromeOS::MemoryPressureThresholds
346 GetMemoryPressureThresholds() {
347 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
348 kMemoryPressureThresholds
)) {
349 const std::string group_name
=
350 base::FieldTrialList::FindFullName(kMemoryPressureExperimentName
);
351 if (group_name
== kConservativeThreshold
)
352 return base::MemoryPressureObserverChromeOS::THRESHOLD_CONSERVATIVE
;
353 if (group_name
== kAggressiveCacheDiscardThreshold
)
354 return base::MemoryPressureObserverChromeOS::
355 THRESHOLD_AGGRESSIVE_CACHE_DISCARD
;
356 if (group_name
== kAggressiveTabDiscardThreshold
)
357 return base::MemoryPressureObserverChromeOS::
358 THRESHOLD_AGGRESSIVE_TAB_DISCARD
;
359 if (group_name
== kAggressiveThreshold
)
360 return base::MemoryPressureObserverChromeOS::THRESHOLD_AGGRESSIVE
;
361 return base::MemoryPressureObserverChromeOS::THRESHOLD_DEFAULT
;
364 const std::string option
=
365 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
366 kMemoryPressureThresholds
);
367 if (option
== kConservativeThreshold
)
368 return base::MemoryPressureObserverChromeOS::THRESHOLD_CONSERVATIVE
;
369 if (option
== kAggressiveCacheDiscardThreshold
)
370 return base::MemoryPressureObserverChromeOS::
371 THRESHOLD_AGGRESSIVE_CACHE_DISCARD
;
372 if (option
== kAggressiveTabDiscardThreshold
)
373 return base::MemoryPressureObserverChromeOS::
374 THRESHOLD_AGGRESSIVE_TAB_DISCARD
;
375 if (option
== kAggressiveThreshold
)
376 return base::MemoryPressureObserverChromeOS::THRESHOLD_AGGRESSIVE
;
378 return base::MemoryPressureObserverChromeOS::THRESHOLD_DEFAULT
;
381 } // namespace switches
382 } // namespace chromeos