Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / chromeos / chromeos_switches.cc
blob648ddcaf48422fc05be9ea86cff1a7822a9adfbf
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 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
86 // testing.
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 // Don't create robot account on enrollment. Used when testing device
168 // enrollment against YAPS or the Python test server.
169 const char kEnterpriseEnrollmentSkipRobotAuth[] =
170 "enterprise-enrollment-skip-robot-auth";
172 // Enables the chromecast support for video player app.
173 const char kEnableVideoPlayerChromecastSupport[] =
174 "enable-video-player-chromecast-support";
176 // Passed to Chrome the first time that it's run after the system boots.
177 // Not passed on restart after sign out.
178 const char kFirstExecAfterBoot[] = "first-exec-after-boot";
180 // Usually in browser tests the usual login manager bringup is skipped so that
181 // tests can change how it's brought up. This flag disables that.
182 const char kForceLoginManagerInTests[] = "force-login-manager-in-tests";
184 // Indicates that the browser is in "browse without sign-in" (Guest session)
185 // mode. Should completely disable extensions, sync and bookmarks.
186 const char kGuestSession[] = "bwsi";
188 // Wallpaper to use in guest mode (as paths to trusted, non-user-writable JPEG
189 // files).
190 const char kGuestWallpaperLarge[] = "guest-wallpaper-large";
191 const char kGuestWallpaperSmall[] = "guest-wallpaper-small";
193 // If true, the Chromebook has a Chrome OS keyboard. Don't use the flag for
194 // Chromeboxes.
195 const char kHasChromeOSKeyboard[] = "has-chromeos-keyboard";
197 // If true, the Chromebook has a keyboard with a diamond key.
198 const char kHasChromeOSDiamondKey[] = "has-chromeos-diamond-key";
200 // Defines user homedir. This defaults to primary user homedir.
201 const char kHomedir[] = "homedir";
203 // With this switch, start remora OOBE with the pairing screen.
204 const char kHostPairingOobe[] = "host-pairing-oobe";
206 // If true, profile selection in UserManager will always return active user's
207 // profile.
208 // TODO(nkostlyev): http://crbug.com/364604 - Get rid of this switch after we
209 // turn on multi-profile feature on ChromeOS.
210 const char kIgnoreUserProfileMappingForTests[] =
211 "ignore-user-profile-mapping-for-tests";
213 // File to load internal display ICC file from.
214 const char kInternalDisplayColorProfileFile[] =
215 "internal-display-color-profile-file";
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 // Values are case sensitive and based on Shill names in service_constants.h.
265 // See FakeShillManagerClient::SetInitialNetworkState for implementation.
266 // Examples:
267 // 'clear=1' - Clears all default configurations
268 // 'wifi=on' - A wifi network is initially connected ('1' also works)
269 // 'wifi=off' - Wifi networks are all initially disconnected ('0' also works)
270 // 'wifi=disabled' - Wifi is initially disabled
271 // 'wifi=none' - Wifi is unavailable
272 // 'wifi=portal' - Wifi connection will be in Portal state
273 // 'cellular=1' - Cellular is initially connected
274 // 'cellular=LTE' - Cellular is initially connected, technology is LTE
275 // 'interactive=3' - Interactive mode, connect/scan/etc requests take 3 secs
276 const char kShillStub[] = "shill-stub";
278 // Sends test messages on first call to RequestUpdate (stub only).
279 const char kSmsTestMessages[] = "sms-test-messages";
281 // Indicates that a stub implementation of CrosSettings that stores settings in
282 // memory without signing should be used, treating current user as the owner.
283 // This option is for testing the chromeos build of chrome on the desktop only.
284 const char kStubCrosSettings[] = "stub-cros-settings";
286 // Indicates that the system is running in dev mode. The dev mode probing is
287 // done by session manager.
288 const char kSystemDevMode[] = "system-developer-mode";
290 // Enables animated transitions during first-run tutorial.
291 const char kEnableFirstRunUITransitions[] = "enable-first-run-ui-transitions";
293 // Forces first-run UI to be shown for every login.
294 const char kForceFirstRunUI[] = "force-first-run-ui";
296 // Enables testing for auto update UI.
297 const char kTestAutoUpdateUI[] = "test-auto-update-ui";
299 // Enables testing Metronome client with a periodic timer.
300 const char kTestMetronomeTimer[] = "test-metronome-timer";
302 // Disable memory pressure checks on ChromeOS.
303 const char kDisableMemoryPressureSystemChromeOS[] =
304 "disable-memory-pressure-chromeos";
306 // Enables waking the device based on the receipt of some network packets.
307 const char kWakeOnPackets[] = "wake-on-packets";
309 // Screenshot testing: specifies the directory where the golden screenshots are
310 // stored.
311 const char kGoldenScreenshotsDir[] = "golden-screenshots-dir";
313 // Screenshot testing: specifies the directoru where artifacts will be stored.
314 const char kArtifactsDir[] = "artifacts-dir";
316 // Disable bypass proxy for captive portal authorization.
317 const char kDisableCaptivePortalBypassProxy[] =
318 "disable-captive-portal-bypass-proxy";
320 // Disable automatic timezone update.
321 const char kDisableTimeZoneTrackingOption[] =
322 "disable-timezone-tracking-option";
324 // Disable new GAIA sign-in flow.
325 const char kDisableWebviewSigninFlow[] = "disable-webview-signin-flow";
327 // Enables searching for an app that supports a plugged in USB printer. When a
328 // user plugs in USB printer, they are shown a notification offering to search
329 // Chrome Web Store for an app that has printerProvider permission and can
330 // handle the plugged in printer.
331 const char kEnablePrinterAppSearch[] = "enable-printer-app-search";
333 // Switches and optional value for Data Saver prompt on cellular networks.
334 const char kDisableDataSaverPrompt[] = "disable-datasaver-prompt";
335 const char kEnableDataSaverPrompt[] = "enable-datasaver-prompt";
336 const char kDataSaverPromptDemoMode[] = "demo";
338 bool WakeOnWifiEnabled() {
339 return !base::CommandLine::ForCurrentProcess()->HasSwitch(kDisableWakeOnWifi);
342 bool MemoryPressureHandlingEnabled() {
343 if ((base::CommandLine::ForCurrentProcess()->HasSwitch(
344 chromeos::switches::kDisableMemoryPressureSystemChromeOS)) ||
345 (base::FieldTrialList::FindFullName(kMemoryPressureExperimentName) ==
346 kMemoryPressureHandlingOff))
347 return false;
348 return true;
351 base::chromeos::MemoryPressureMonitor::MemoryPressureThresholds
352 GetMemoryPressureThresholds() {
353 using MemoryPressureMonitor = base::chromeos::MemoryPressureMonitor;
355 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
356 kMemoryPressureThresholds)) {
357 const std::string group_name =
358 base::FieldTrialList::FindFullName(kMemoryPressureExperimentName);
359 if (group_name == kConservativeThreshold)
360 return MemoryPressureMonitor::THRESHOLD_CONSERVATIVE;
361 if (group_name == kAggressiveCacheDiscardThreshold)
362 return MemoryPressureMonitor::THRESHOLD_AGGRESSIVE_CACHE_DISCARD;
363 if (group_name == kAggressiveTabDiscardThreshold)
364 return MemoryPressureMonitor::THRESHOLD_AGGRESSIVE_TAB_DISCARD;
365 if (group_name == kAggressiveThreshold)
366 return MemoryPressureMonitor::THRESHOLD_AGGRESSIVE;
367 return MemoryPressureMonitor::THRESHOLD_DEFAULT;
370 const std::string option =
371 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
372 kMemoryPressureThresholds);
373 if (option == kConservativeThreshold)
374 return MemoryPressureMonitor::THRESHOLD_CONSERVATIVE;
375 if (option == kAggressiveCacheDiscardThreshold)
376 return MemoryPressureMonitor::THRESHOLD_AGGRESSIVE_CACHE_DISCARD;
377 if (option == kAggressiveTabDiscardThreshold)
378 return MemoryPressureMonitor::THRESHOLD_AGGRESSIVE_TAB_DISCARD;
379 if (option == kAggressiveThreshold)
380 return MemoryPressureMonitor::THRESHOLD_AGGRESSIVE;
382 return MemoryPressureMonitor::THRESHOLD_DEFAULT;
385 } // namespace switches
386 } // namespace chromeos