| OLD | NEW | 
|    1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |    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 |    2 // Use of this source code is governed by a BSD-style license that can be | 
|    3 // found in the LICENSE file. |    3 // found in the LICENSE file. | 
|    4  |    4  | 
|    5 #include "chromeos/chromeos_switches.h" |    5 #include "chromeos/chromeos_switches.h" | 
|    6  |    6  | 
|    7 #include "base/command_line.h" |    7 #include "base/command_line.h" | 
 |    8 #include "base/metrics/field_trial.h" | 
|    8  |    9  | 
|    9 // TODO(rsorokin): alphabetize all of these switches so they |   10 // TODO(rsorokin): alphabetize all of these switches so they | 
|   10 // match the order from the .h file |   11 // match the order from the .h file | 
|   11  |   12  | 
|   12 namespace chromeos { |   13 namespace chromeos { | 
|   13 namespace switches { |   14 namespace switches { | 
|   14  |   15  | 
|   15 // Path for app's OEM manifest file. |   16 // Path for app's OEM manifest file. | 
|   16 const char kAppOemManifestFile[] = "app-mode-oem-manifest"; |   17 const char kAppOemManifestFile[] = "app-mode-oem-manifest"; | 
|   17  |   18  | 
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  214 // Specifies the profile to use once a chromeos user is logged in. |  215 // Specifies the profile to use once a chromeos user is logged in. | 
|  215 // This parameter is ignored if user goes through login screen since user_id |  216 // This parameter is ignored if user goes through login screen since user_id | 
|  216 // hash defines which profile directory to use. |  217 // hash defines which profile directory to use. | 
|  217 // In case of browser restart within active session this parameter is used |  218 // In case of browser restart within active session this parameter is used | 
|  218 // to pass user_id hash for primary user. |  219 // to pass user_id hash for primary user. | 
|  219 const char kLoginProfile[] = "login-profile"; |  220 const char kLoginProfile[] = "login-profile"; | 
|  220  |  221  | 
|  221 // Specifies the user which is already logged in. |  222 // Specifies the user which is already logged in. | 
|  222 const char kLoginUser[] = "login-user"; |  223 const char kLoginUser[] = "login-user"; | 
|  223  |  224  | 
|  224 // The memory pressure thresholds selection which is used to decide when a |  225 // The memory pressure thresholds selection which is used to decide whether and | 
|  225 // memory pressure event needs to get fired. |  226 // when a memory pressure event needs to get fired. | 
 |  227 const char kMemoryPressureHandlingOff[] = "memory-pressure-off"; | 
|  226 const char kMemoryPressureThresholds[] = "memory-pressure-thresholds"; |  228 const char kMemoryPressureThresholds[] = "memory-pressure-thresholds"; | 
 |  229 const char kConservativeThreshold[] = "conservative"; | 
 |  230 const char kAggressiveCacheDiscardThreshold[] = "aggressive-cache-discard"; | 
 |  231 const char kAggressiveTabDiscardThreshold[] = "aggressive-tab-discard"; | 
 |  232 const char kAggressiveThreshold[] = "aggressive"; | 
|  227  |  233  | 
|  228 // Enables natural scroll by default. |  234 // Enables natural scroll by default. | 
|  229 const char kNaturalScrollDefault[] = "enable-natural-scroll-default"; |  235 const char kNaturalScrollDefault[] = "enable-natural-scroll-default"; | 
|  230  |  236  | 
|  231 // Skips all other OOBE pages after user login. |  237 // Skips all other OOBE pages after user login. | 
|  232 const char kOobeSkipPostLogin[] = "oobe-skip-postlogin"; |  238 const char kOobeSkipPostLogin[] = "oobe-skip-postlogin"; | 
|  233  |  239  | 
|  234 // Disable GAIA services such as enrollment and OAuth session restore. Used by |  240 // Disable GAIA services such as enrollment and OAuth session restore. Used by | 
|  235 // 'fake' telemetry login. |  241 // 'fake' telemetry login. | 
|  236 const char kDisableGaiaServices[] = "disable-gaia-services"; |  242 const char kDisableGaiaServices[] = "disable-gaia-services"; | 
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  305     "enable-captive-portal-bypass-proxy"; |  311     "enable-captive-portal-bypass-proxy"; | 
|  306  |  312  | 
|  307 // Disable automatic timezone update. |  313 // Disable automatic timezone update. | 
|  308 const char kDisableTimeZoneTrackingOption[] = |  314 const char kDisableTimeZoneTrackingOption[] = | 
|  309     "disable-timezone-tracking-option"; |  315     "disable-timezone-tracking-option"; | 
|  310  |  316  | 
|  311 bool WakeOnWifiEnabled() { |  317 bool WakeOnWifiEnabled() { | 
|  312   return !base::CommandLine::ForCurrentProcess()->HasSwitch(kDisableWakeOnWifi); |  318   return !base::CommandLine::ForCurrentProcess()->HasSwitch(kDisableWakeOnWifi); | 
|  313 } |  319 } | 
|  314  |  320  | 
 |  321 bool MemoryPressureHandlingEnabled() { | 
 |  322   if ((base::CommandLine::ForCurrentProcess()->HasSwitch( | 
 |  323           chromeos::switches::kDisableMemoryPressureSystemChromeOS)) || | 
 |  324       (base::FieldTrialList::FindFullName(kMemoryPressureThresholds) == | 
 |  325        kMemoryPressureHandlingOff)) | 
 |  326     return false; | 
 |  327   return true; | 
 |  328 } | 
 |  329  | 
|  315 base::MemoryPressureObserverChromeOS::MemoryPressureThresholds |  330 base::MemoryPressureObserverChromeOS::MemoryPressureThresholds | 
|  316 GetMemoryPressureThresholds() { |  331 GetMemoryPressureThresholds() { | 
|  317   if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |  332   if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 
|  318           kMemoryPressureThresholds)) { |  333           kMemoryPressureThresholds)) { | 
 |  334     const std::string group_name = | 
 |  335         base::FieldTrialList::FindFullName(kMemoryPressureThresholds); | 
 |  336     if (group_name == kConservativeThreshold) | 
 |  337       return base::MemoryPressureObserverChromeOS::THRESHOLD_CONSERVATIVE; | 
 |  338     if (group_name == kAggressiveCacheDiscardThreshold) | 
 |  339       return base::MemoryPressureObserverChromeOS:: | 
 |  340           THRESHOLD_AGGRESSIVE_CACHE_DISCARD; | 
 |  341     if (group_name == kAggressiveTabDiscardThreshold) | 
 |  342       return base::MemoryPressureObserverChromeOS:: | 
 |  343           THRESHOLD_AGGRESSIVE_TAB_DISCARD; | 
 |  344     if (group_name == kAggressiveThreshold) | 
 |  345       return base::MemoryPressureObserverChromeOS::THRESHOLD_AGGRESSIVE; | 
|  319     return base::MemoryPressureObserverChromeOS::THRESHOLD_DEFAULT; |  346     return base::MemoryPressureObserverChromeOS::THRESHOLD_DEFAULT; | 
|  320   } |  347   } | 
 |  348  | 
|  321   const std::string option = |  349   const std::string option = | 
|  322       base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |  350       base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 
|  323           kMemoryPressureThresholds); |  351           kMemoryPressureThresholds); | 
|  324   if (option == "1") { |  352   if (option == kConservativeThreshold) | 
|  325     return base::MemoryPressureObserverChromeOS::THRESHOLD_CONSERVATIVE; |  353     return base::MemoryPressureObserverChromeOS::THRESHOLD_CONSERVATIVE; | 
|  326   } |  354   if (option == kAggressiveCacheDiscardThreshold) | 
|  327   if (option == "2") { |  | 
|  328     return base::MemoryPressureObserverChromeOS:: |  355     return base::MemoryPressureObserverChromeOS:: | 
|  329         THRESHOLD_AGGRESSIVE_CACHE_DISCARD; |  356         THRESHOLD_AGGRESSIVE_CACHE_DISCARD; | 
|  330   } |  357   if (option == kAggressiveTabDiscardThreshold) | 
|  331   if (option == "3") { |  | 
|  332     return base::MemoryPressureObserverChromeOS:: |  358     return base::MemoryPressureObserverChromeOS:: | 
|  333         THRESHOLD_AGGRESSIVE_TAB_DISCARD; |  359         THRESHOLD_AGGRESSIVE_TAB_DISCARD; | 
|  334   } |  360   if (option == kAggressiveThreshold) | 
|  335   return base::MemoryPressureObserverChromeOS::THRESHOLD_AGGRESSIVE; |  361     return base::MemoryPressureObserverChromeOS::THRESHOLD_AGGRESSIVE; | 
 |  362  | 
 |  363   return base::MemoryPressureObserverChromeOS::THRESHOLD_DEFAULT; | 
|  336 } |  364 } | 
|  337  |  365  | 
|  338 }  // namespace switches |  366 }  // namespace switches | 
|  339 }  // namespace chromeos |  367 }  // namespace chromeos | 
| OLD | NEW |