Chromium Code Reviews| 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> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "ash/common/ash_switches.h" | 13 #include "ash/common/ash_switches.h" |
| 14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/memory/ptr_util.h" | 16 #include "base/memory/ptr_util.h" |
| 17 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
| 18 #include "base/strings/string_split.h" | 18 #include "base/strings/string_split.h" |
| 19 #include "base/values.h" | 19 #include "base/values.h" |
| 20 #include "build/build_config.h" | 20 #include "build/build_config.h" |
| 21 #include "chrome/browser/android/preferences/command_line_pref_store_android.h" | |
|
Lei Zhang
2016/10/26 01:52:05
Put this behind #if defined(OS_ANDROID) down aroun
Menglin
2016/10/26 19:28:33
Done.
| |
| 21 #include "chrome/common/chrome_switches.h" | 22 #include "chrome/common/chrome_switches.h" |
| 22 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
| 23 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_ names.h" | 24 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_ names.h" |
| 24 #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" |
| 25 #include "components/proxy_config/proxy_config_dictionary.h" | 26 #include "components/proxy_config/proxy_config_dictionary.h" |
| 26 #include "components/proxy_config/proxy_config_pref_names.h" | 27 #include "components/proxy_config/proxy_config_pref_names.h" |
| 27 #include "components/ssl_config/ssl_config_prefs.h" | 28 #include "components/ssl_config/ssl_config_prefs.h" |
| 28 #include "components/ssl_config/ssl_config_switches.h" | 29 #include "components/ssl_config/ssl_config_switches.h" |
| 29 #include "content/public/common/content_switches.h" | 30 #include "content/public/common/content_switches.h" |
| 30 #include "ui/base/ui_base_switches.h" | 31 #include "ui/base/ui_base_switches.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 107 } | 108 } |
| 108 return true; | 109 return true; |
| 109 } | 110 } |
| 110 | 111 |
| 111 void ChromeCommandLinePrefStore::ApplySimpleSwitches() { | 112 void ChromeCommandLinePrefStore::ApplySimpleSwitches() { |
| 112 // Look for each switch we know about and set its preference accordingly. | 113 // Look for each switch we know about and set its preference accordingly. |
| 113 ApplyStringSwitches(string_switch_map_, arraysize(string_switch_map_)); | 114 ApplyStringSwitches(string_switch_map_, arraysize(string_switch_map_)); |
| 114 ApplyPathSwitches(path_switch_map_, arraysize(path_switch_map_)); | 115 ApplyPathSwitches(path_switch_map_, arraysize(path_switch_map_)); |
| 115 ApplyIntegerSwitches(integer_switch_map_, arraysize(integer_switch_map_)); | 116 ApplyIntegerSwitches(integer_switch_map_, arraysize(integer_switch_map_)); |
| 116 ApplyBooleanSwitches(boolean_switch_map_, arraysize(boolean_switch_map_)); | 117 ApplyBooleanSwitches(boolean_switch_map_, arraysize(boolean_switch_map_)); |
| 118 #if defined(OS_ANDROID) | |
| 119 ::android::ApplyBlimpSwitches(this); | |
| 120 #endif | |
| 117 } | 121 } |
| 118 | 122 |
| 119 void ChromeCommandLinePrefStore::ApplyProxyMode() { | 123 void ChromeCommandLinePrefStore::ApplyProxyMode() { |
| 120 if (command_line()->HasSwitch(switches::kNoProxyServer)) { | 124 if (command_line()->HasSwitch(switches::kNoProxyServer)) { |
| 121 SetValue(proxy_config::prefs::kProxy, | 125 SetValue(proxy_config::prefs::kProxy, |
| 122 base::WrapUnique(ProxyConfigDictionary::CreateDirect()), | 126 base::WrapUnique(ProxyConfigDictionary::CreateDirect()), |
| 123 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); | 127 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); |
| 124 } else if (command_line()->HasSwitch(switches::kProxyPacUrl)) { | 128 } else if (command_line()->HasSwitch(switches::kProxyPacUrl)) { |
| 125 std::string pac_script_url = | 129 std::string pac_script_url = |
| 126 command_line()->GetSwitchValueASCII(switches::kProxyPacUrl); | 130 command_line()->GetSwitchValueASCII(switches::kProxyPacUrl); |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 155 } | 159 } |
| 156 } | 160 } |
| 157 | 161 |
| 158 void ChromeCommandLinePrefStore::ApplyBackgroundModeSwitches() { | 162 void ChromeCommandLinePrefStore::ApplyBackgroundModeSwitches() { |
| 159 if (command_line()->HasSwitch(switches::kDisableExtensions)) { | 163 if (command_line()->HasSwitch(switches::kDisableExtensions)) { |
| 160 SetValue(prefs::kBackgroundModeEnabled, | 164 SetValue(prefs::kBackgroundModeEnabled, |
| 161 base::MakeUnique<base::FundamentalValue>(false), | 165 base::MakeUnique<base::FundamentalValue>(false), |
| 162 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); | 166 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); |
| 163 } | 167 } |
| 164 } | 168 } |
| OLD | NEW |