Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Side by Side Diff: chrome/browser/prefs/chrome_command_line_pref_store.cc

Issue 2785883003: Use unique_ptr<DictionaryValue> in ProxyConfigDictionary (Closed)
Patch Set: Fix compilation Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 void ChromeCommandLinePrefStore::ApplySimpleSwitches() { 116 void ChromeCommandLinePrefStore::ApplySimpleSwitches() {
117 // 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.
118 ApplyStringSwitches(string_switch_map_, arraysize(string_switch_map_)); 118 ApplyStringSwitches(string_switch_map_, arraysize(string_switch_map_));
119 ApplyPathSwitches(path_switch_map_, arraysize(path_switch_map_)); 119 ApplyPathSwitches(path_switch_map_, arraysize(path_switch_map_));
120 ApplyIntegerSwitches(integer_switch_map_, arraysize(integer_switch_map_)); 120 ApplyIntegerSwitches(integer_switch_map_, arraysize(integer_switch_map_));
121 ApplyBooleanSwitches(boolean_switch_map_, arraysize(boolean_switch_map_)); 121 ApplyBooleanSwitches(boolean_switch_map_, arraysize(boolean_switch_map_));
122 } 122 }
123 123
124 void ChromeCommandLinePrefStore::ApplyProxyMode() { 124 void ChromeCommandLinePrefStore::ApplyProxyMode() {
125 if (command_line()->HasSwitch(switches::kNoProxyServer)) { 125 if (command_line()->HasSwitch(switches::kNoProxyServer)) {
126 SetValue(proxy_config::prefs::kProxy, 126 SetValue(proxy_config::prefs::kProxy, ProxyConfigDictionary::CreateDirect(),
127 base::WrapUnique(ProxyConfigDictionary::CreateDirect()),
128 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); 127 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
129 } else if (command_line()->HasSwitch(switches::kProxyPacUrl)) { 128 } else if (command_line()->HasSwitch(switches::kProxyPacUrl)) {
130 std::string pac_script_url = 129 std::string pac_script_url =
131 command_line()->GetSwitchValueASCII(switches::kProxyPacUrl); 130 command_line()->GetSwitchValueASCII(switches::kProxyPacUrl);
132 SetValue(proxy_config::prefs::kProxy, 131 SetValue(proxy_config::prefs::kProxy,
133 base::WrapUnique( 132 ProxyConfigDictionary::CreatePacScript(pac_script_url, false),
134 ProxyConfigDictionary::CreatePacScript(pac_script_url, false)),
135 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); 133 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
136 } else if (command_line()->HasSwitch(switches::kProxyAutoDetect)) { 134 } else if (command_line()->HasSwitch(switches::kProxyAutoDetect)) {
137 SetValue(proxy_config::prefs::kProxy, 135 SetValue(proxy_config::prefs::kProxy,
138 base::WrapUnique(ProxyConfigDictionary::CreateAutoDetect()), 136 ProxyConfigDictionary::CreateAutoDetect(),
139 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); 137 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
140 } else if (command_line()->HasSwitch(switches::kProxyServer)) { 138 } else if (command_line()->HasSwitch(switches::kProxyServer)) {
141 std::string proxy_server = 139 std::string proxy_server =
142 command_line()->GetSwitchValueASCII(switches::kProxyServer); 140 command_line()->GetSwitchValueASCII(switches::kProxyServer);
143 std::string bypass_list = 141 std::string bypass_list =
144 command_line()->GetSwitchValueASCII(switches::kProxyBypassList); 142 command_line()->GetSwitchValueASCII(switches::kProxyBypassList);
145 SetValue(proxy_config::prefs::kProxy, 143 SetValue(
146 base::WrapUnique(ProxyConfigDictionary::CreateFixedServers( 144 proxy_config::prefs::kProxy,
147 proxy_server, bypass_list)), 145 ProxyConfigDictionary::CreateFixedServers(proxy_server, bypass_list),
148 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); 146 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
149 } 147 }
150 } 148 }
151 149
152 void ChromeCommandLinePrefStore::ApplySSLSwitches() { 150 void ChromeCommandLinePrefStore::ApplySSLSwitches() {
153 if (command_line()->HasSwitch(switches::kCipherSuiteBlacklist)) { 151 if (command_line()->HasSwitch(switches::kCipherSuiteBlacklist)) {
154 std::unique_ptr<base::ListValue> list_value(new base::ListValue()); 152 std::unique_ptr<base::ListValue> list_value(new base::ListValue());
155 list_value->AppendStrings(base::SplitString( 153 list_value->AppendStrings(base::SplitString(
156 command_line()->GetSwitchValueASCII(switches::kCipherSuiteBlacklist), 154 command_line()->GetSwitchValueASCII(switches::kCipherSuiteBlacklist),
157 ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)); 155 ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL));
158 SetValue(ssl_config::prefs::kCipherSuiteBlacklist, std::move(list_value), 156 SetValue(ssl_config::prefs::kCipherSuiteBlacklist, std::move(list_value),
159 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); 157 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
160 } 158 }
161 } 159 }
162 160
163 void ChromeCommandLinePrefStore::ApplyBackgroundModeSwitches() { 161 void ChromeCommandLinePrefStore::ApplyBackgroundModeSwitches() {
164 if (command_line()->HasSwitch(switches::kDisableExtensions)) { 162 if (command_line()->HasSwitch(switches::kDisableExtensions)) {
165 SetValue(prefs::kBackgroundModeEnabled, 163 SetValue(prefs::kBackgroundModeEnabled,
166 base::MakeUnique<base::Value>(false), 164 base::MakeUnique<base::Value>(false),
167 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); 165 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
168 } 166 }
169 } 167 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698