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 // 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
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
185 const char kGuestWallpaperLarge
[] = "guest-wallpaper-large";
186 const char kGuestWallpaperSmall
[] = "guest-wallpaper-small";
188 // If true, the Chromebook has a keyboard with a diamond key.
189 const char kHasChromeOSDiamondKey
[] = "has-chromeos-diamond-key";
191 // Defines user homedir. This defaults to primary user homedir.
192 const char kHomedir
[] = "homedir";
194 // With this switch, start remora OOBE with the pairing screen.
195 const char kHostPairingOobe
[] = "host-pairing-oobe";
197 // If true, profile selection in UserManager will always return active user's
199 // TODO(nkostlyev): http://crbug.com/364604 - Get rid of this switch after we
200 // turn on multi-profile feature on ChromeOS.
201 const char kIgnoreUserProfileMappingForTests
[] =
202 "ignore-user-profile-mapping-for-tests";
204 // File to load internal display ICC file from.
205 const char kInternalDisplayColorProfileFile
[] =
206 "internal-display-color-profile-file";
208 // Enables Chrome-as-a-login-manager behavior.
209 const char kLoginManager
[] = "login-manager";
211 // Specifies the profile to use once a chromeos user is logged in.
212 // This parameter is ignored if user goes through login screen since user_id
213 // hash defines which profile directory to use.
214 // In case of browser restart within active session this parameter is used
215 // to pass user_id hash for primary user.
216 const char kLoginProfile
[] = "login-profile";
218 // Specifies the user which is already logged in.
219 const char kLoginUser
[] = "login-user";
221 // The memory pressure thresholds selection which is used to decide whether and
222 // when a memory pressure event needs to get fired.
223 const char kMemoryPressureExperimentName
[] = "ChromeOSMemoryPressureHandling";
224 const char kMemoryPressureHandlingOff
[] = "memory-pressure-off";
225 const char kMemoryPressureThresholds
[] = "memory-pressure-thresholds";
226 const char kConservativeThreshold
[] = "conservative";
227 const char kAggressiveCacheDiscardThreshold
[] = "aggressive-cache-discard";
228 const char kAggressiveTabDiscardThreshold
[] = "aggressive-tab-discard";
229 const char kAggressiveThreshold
[] = "aggressive";
231 // Enables natural scroll by default.
232 const char kNaturalScrollDefault
[] = "enable-natural-scroll-default";
234 // Skips all other OOBE pages after user login.
235 const char kOobeSkipPostLogin
[] = "oobe-skip-postlogin";
237 // Disable GAIA services such as enrollment and OAuth session restore. Used by
238 // 'fake' telemetry login.
239 const char kDisableGaiaServices
[] = "disable-gaia-services";
241 // Interval at which we check for total time on OOBE.
242 const char kOobeTimerInterval
[] = "oobe-timer-interval";
244 // Indicates that a guest session has been started before OOBE completion.
245 const char kOobeGuestSession
[] = "oobe-guest-session";
247 // Specifies power stub behavior:
248 // 'cycle=2' - Cycles power states every 2 seconds.
249 // See FakeDBusThreadManager::ParsePowerCommandLineSwitch for full details.
250 const char kPowerStub
[] = "power-stub";
252 // Overrides network stub behavior. By default, ethernet, wifi and vpn are
253 // enabled, and transitions occur instantaneously. Multiple options can be
254 // comma separated (no spaces). Note: all options are in the format 'foo=x'.
255 // Values are case sensitive and based on Shill names in service_constants.h.
256 // See FakeShillManagerClient::SetInitialNetworkState for implementation.
258 // 'clear=1' - Clears all default configurations
259 // 'wifi=on' - A wifi network is initially connected ('1' also works)
260 // 'wifi=off' - Wifi networks are all initially disconnected ('0' also works)
261 // 'wifi=disabled' - Wifi is initially disabled
262 // 'wifi=none' - Wifi is unavailable
263 // 'wifi=portal' - Wifi connection will be in Portal state
264 // 'cellular=1' - Cellular is initially connected
265 // 'cellular=LTE' - Cellular is initially connected, technology is LTE
266 // 'interactive=3' - Interactive mode, connect/scan/etc requests take 3 secs
267 const char kShillStub
[] = "shill-stub";
269 // Sends test messages on first call to RequestUpdate (stub only).
270 const char kSmsTestMessages
[] = "sms-test-messages";
272 // Indicates that a stub implementation of CrosSettings that stores settings in
273 // memory without signing should be used, treating current user as the owner.
274 // This also modifies OwnerSettingsServiceChromeOS::HandlesSetting such that no
275 // settings are handled by OwnerSettingsServiceChromeOS.
276 // This option is for testing the chromeos build of chrome on the desktop only.
277 const char kStubCrosSettings
[] = "stub-cros-settings";
279 // Indicates that the system is running in dev mode. The dev mode probing is
280 // done by session manager.
281 const char kSystemDevMode
[] = "system-developer-mode";
283 // Enables animated transitions during first-run tutorial.
284 const char kEnableFirstRunUITransitions
[] = "enable-first-run-ui-transitions";
286 // Forces first-run UI to be shown for every login.
287 const char kForceFirstRunUI
[] = "force-first-run-ui";
289 // Enables testing for auto update UI.
290 const char kTestAutoUpdateUI
[] = "test-auto-update-ui";
292 // Enables waking the device based on the receipt of some network packets.
293 const char kWakeOnPackets
[] = "wake-on-packets";
295 // Screenshot testing: specifies the directory where the golden screenshots are
297 const char kGoldenScreenshotsDir
[] = "golden-screenshots-dir";
299 // Screenshot testing: specifies the directoru where artifacts will be stored.
300 const char kArtifactsDir
[] = "artifacts-dir";
302 // Disable bypass proxy for captive portal authorization.
303 const char kDisableCaptivePortalBypassProxy
[] =
304 "disable-captive-portal-bypass-proxy";
306 // Disable automatic timezone update.
307 const char kDisableTimeZoneTrackingOption
[] =
308 "disable-timezone-tracking-option";
310 // Switches and optional value for Data Saver prompt on cellular networks.
311 const char kDisableDataSaverPrompt
[] = "disable-datasaver-prompt";
312 const char kEnableDataSaverPrompt
[] = "enable-datasaver-prompt";
313 const char kDataSaverPromptDemoMode
[] = "demo";
315 bool WakeOnWifiEnabled() {
316 return !base::CommandLine::ForCurrentProcess()->HasSwitch(kDisableWakeOnWifi
);
319 bool MemoryPressureHandlingEnabled() {
320 if (base::FieldTrialList::FindFullName(kMemoryPressureExperimentName
) ==
321 kMemoryPressureHandlingOff
) {
327 base::chromeos::MemoryPressureMonitor::MemoryPressureThresholds
328 GetMemoryPressureThresholds() {
329 using MemoryPressureMonitor
= base::chromeos::MemoryPressureMonitor
;
331 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
332 kMemoryPressureThresholds
)) {
333 const std::string group_name
=
334 base::FieldTrialList::FindFullName(kMemoryPressureExperimentName
);
335 if (group_name
== kConservativeThreshold
)
336 return MemoryPressureMonitor::THRESHOLD_CONSERVATIVE
;
337 if (group_name
== kAggressiveCacheDiscardThreshold
)
338 return MemoryPressureMonitor::THRESHOLD_AGGRESSIVE_CACHE_DISCARD
;
339 if (group_name
== kAggressiveTabDiscardThreshold
)
340 return MemoryPressureMonitor::THRESHOLD_AGGRESSIVE_TAB_DISCARD
;
341 if (group_name
== kAggressiveThreshold
)
342 return MemoryPressureMonitor::THRESHOLD_AGGRESSIVE
;
343 return MemoryPressureMonitor::THRESHOLD_DEFAULT
;
346 const std::string option
=
347 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
348 kMemoryPressureThresholds
);
349 if (option
== kConservativeThreshold
)
350 return MemoryPressureMonitor::THRESHOLD_CONSERVATIVE
;
351 if (option
== kAggressiveCacheDiscardThreshold
)
352 return MemoryPressureMonitor::THRESHOLD_AGGRESSIVE_CACHE_DISCARD
;
353 if (option
== kAggressiveTabDiscardThreshold
)
354 return MemoryPressureMonitor::THRESHOLD_AGGRESSIVE_TAB_DISCARD
;
355 if (option
== kAggressiveThreshold
)
356 return MemoryPressureMonitor::THRESHOLD_AGGRESSIVE
;
358 return MemoryPressureMonitor::THRESHOLD_DEFAULT
;
361 } // namespace switches
362 } // namespace chromeos