| 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 "chrome/browser/prefs/chrome_command_line_pref_store.h" | 5 #include "chrome/browser/prefs/chrome_command_line_pref_store.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switc
hes.h" | 25 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switc
hes.h" |
| 26 #include "components/proxy_config/proxy_config_dictionary.h" | 26 #include "components/proxy_config/proxy_config_dictionary.h" |
| 27 #include "components/proxy_config/proxy_config_pref_names.h" | 27 #include "components/proxy_config/proxy_config_pref_names.h" |
| 28 #include "components/ssl_config/ssl_config_prefs.h" | 28 #include "components/ssl_config/ssl_config_prefs.h" |
| 29 #include "components/ssl_config/ssl_config_switches.h" | 29 #include "components/ssl_config/ssl_config_switches.h" |
| 30 #include "components/sync/base/pref_names.h" | 30 #include "components/sync/base/pref_names.h" |
| 31 #include "content/public/common/content_switches.h" | 31 #include "content/public/common/content_switches.h" |
| 32 #include "ui/base/ui_base_switches.h" | 32 #include "ui/base/ui_base_switches.h" |
| 33 #include "ui/display/display_switches.h" | 33 #include "ui/display/display_switches.h" |
| 34 | 34 |
| 35 #if defined(OS_ANDROID) | |
| 36 #include "chrome/browser/android/preferences/command_line_pref_store_android.h" | |
| 37 #endif | |
| 38 | |
| 39 #if defined(OS_CHROMEOS) | 35 #if defined(OS_CHROMEOS) |
| 40 #include "chromeos/chromeos_switches.h" | 36 #include "chromeos/chromeos_switches.h" |
| 41 #endif | 37 #endif |
| 42 | 38 |
| 43 const CommandLinePrefStore::SwitchToPreferenceMapEntry | 39 const CommandLinePrefStore::SwitchToPreferenceMapEntry |
| 44 ChromeCommandLinePrefStore::string_switch_map_[] = { | 40 ChromeCommandLinePrefStore::string_switch_map_[] = { |
| 45 { switches::kLang, prefs::kApplicationLocale }, | 41 { switches::kLang, prefs::kApplicationLocale }, |
| 46 { data_reduction_proxy::switches::kDataReductionProxy, | 42 { data_reduction_proxy::switches::kDataReductionProxy, |
| 47 data_reduction_proxy::prefs::kDataReductionProxy }, | 43 data_reduction_proxy::prefs::kDataReductionProxy }, |
| 48 { switches::kAuthServerWhitelist, prefs::kAuthServerWhitelist }, | 44 { switches::kAuthServerWhitelist, prefs::kAuthServerWhitelist }, |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 } | 112 } |
| 117 return true; | 113 return true; |
| 118 } | 114 } |
| 119 | 115 |
| 120 void ChromeCommandLinePrefStore::ApplySimpleSwitches() { | 116 void ChromeCommandLinePrefStore::ApplySimpleSwitches() { |
| 121 // Look for each switch we know about and set its preference accordingly. | 117 // Look for each switch we know about and set its preference accordingly. |
| 122 ApplyStringSwitches(string_switch_map_, arraysize(string_switch_map_)); | 118 ApplyStringSwitches(string_switch_map_, arraysize(string_switch_map_)); |
| 123 ApplyPathSwitches(path_switch_map_, arraysize(path_switch_map_)); | 119 ApplyPathSwitches(path_switch_map_, arraysize(path_switch_map_)); |
| 124 ApplyIntegerSwitches(integer_switch_map_, arraysize(integer_switch_map_)); | 120 ApplyIntegerSwitches(integer_switch_map_, arraysize(integer_switch_map_)); |
| 125 ApplyBooleanSwitches(boolean_switch_map_, arraysize(boolean_switch_map_)); | 121 ApplyBooleanSwitches(boolean_switch_map_, arraysize(boolean_switch_map_)); |
| 126 #if defined(OS_ANDROID) | |
| 127 ::android::ApplyBlimpSwitches(this); | |
| 128 #endif | |
| 129 } | 122 } |
| 130 | 123 |
| 131 void ChromeCommandLinePrefStore::ApplyProxyMode() { | 124 void ChromeCommandLinePrefStore::ApplyProxyMode() { |
| 132 if (command_line()->HasSwitch(switches::kNoProxyServer)) { | 125 if (command_line()->HasSwitch(switches::kNoProxyServer)) { |
| 133 SetValue(proxy_config::prefs::kProxy, | 126 SetValue(proxy_config::prefs::kProxy, |
| 134 base::WrapUnique(ProxyConfigDictionary::CreateDirect()), | 127 base::WrapUnique(ProxyConfigDictionary::CreateDirect()), |
| 135 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); | 128 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); |
| 136 } else if (command_line()->HasSwitch(switches::kProxyPacUrl)) { | 129 } else if (command_line()->HasSwitch(switches::kProxyPacUrl)) { |
| 137 std::string pac_script_url = | 130 std::string pac_script_url = |
| 138 command_line()->GetSwitchValueASCII(switches::kProxyPacUrl); | 131 command_line()->GetSwitchValueASCII(switches::kProxyPacUrl); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 167 } | 160 } |
| 168 } | 161 } |
| 169 | 162 |
| 170 void ChromeCommandLinePrefStore::ApplyBackgroundModeSwitches() { | 163 void ChromeCommandLinePrefStore::ApplyBackgroundModeSwitches() { |
| 171 if (command_line()->HasSwitch(switches::kDisableExtensions)) { | 164 if (command_line()->HasSwitch(switches::kDisableExtensions)) { |
| 172 SetValue(prefs::kBackgroundModeEnabled, | 165 SetValue(prefs::kBackgroundModeEnabled, |
| 173 base::MakeUnique<base::FundamentalValue>(false), | 166 base::MakeUnique<base::FundamentalValue>(false), |
| 174 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); | 167 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); |
| 175 } | 168 } |
| 176 } | 169 } |
| OLD | NEW |