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

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

Issue 6240013: Make proxy settings one atomic dictionary in the PrefStores such that modifications are atomic. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/out/Debug
Patch Set: Fixed Lint comment Created 9 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/command_line_pref_store.h" 5 #include "chrome/browser/prefs/command_line_pref_store.h"
6 6
7 #include "app/app_switches.h" 7 #include "app/app_switches.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/prefs/proxy_prefs.h" 10 #include "chrome/browser/prefs/proxy_config_dictionary.h"
11 #include "chrome/common/chrome_switches.h" 11 #include "chrome/common/chrome_switches.h"
12 #include "chrome/common/pref_names.h" 12 #include "chrome/common/pref_names.h"
13 #include "ui/base/ui_base_switches.h" 13 #include "ui/base/ui_base_switches.h"
14 14
15 const CommandLinePrefStore::StringSwitchToPreferenceMapEntry 15 const CommandLinePrefStore::StringSwitchToPreferenceMapEntry
16 CommandLinePrefStore::string_switch_map_[] = { 16 CommandLinePrefStore::string_switch_map_[] = {
17 { switches::kLang, prefs::kApplicationLocale }, 17 { switches::kLang, prefs::kApplicationLocale },
18 { switches::kProxyServer, prefs::kProxyServer },
19 { switches::kProxyPacUrl, prefs::kProxyPacUrl },
20 { switches::kProxyBypassList, prefs::kProxyBypassList },
21 { switches::kAuthSchemes, prefs::kAuthSchemes }, 18 { switches::kAuthSchemes, prefs::kAuthSchemes },
22 { switches::kAuthServerWhitelist, prefs::kAuthServerWhitelist }, 19 { switches::kAuthServerWhitelist, prefs::kAuthServerWhitelist },
23 { switches::kAuthNegotiateDelegateWhitelist, 20 { switches::kAuthNegotiateDelegateWhitelist,
24 prefs::kAuthNegotiateDelegateWhitelist }, 21 prefs::kAuthNegotiateDelegateWhitelist },
25 { switches::kGSSAPILibraryName, prefs::kGSSAPILibraryName }, 22 { switches::kGSSAPILibraryName, prefs::kGSSAPILibraryName },
26 }; 23 };
27 24
28 const CommandLinePrefStore::BooleanSwitchToPreferenceMapEntry 25 const CommandLinePrefStore::BooleanSwitchToPreferenceMapEntry
29 CommandLinePrefStore::boolean_switch_map_[] = { 26 CommandLinePrefStore::boolean_switch_map_[] = {
30 { switches::kDisableAuthNegotiateCnameLookup, 27 { switches::kDisableAuthNegotiateCnameLookup,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 command_line_->HasSwitch(switches::kProxyBypassList))) { 69 command_line_->HasSwitch(switches::kProxyBypassList))) {
73 LOG(WARNING) << "Additional command-line proxy switches specified when --" 70 LOG(WARNING) << "Additional command-line proxy switches specified when --"
74 << switches::kNoProxyServer << " was also specified."; 71 << switches::kNoProxyServer << " was also specified.";
75 return false; 72 return false;
76 } 73 }
77 return true; 74 return true;
78 } 75 }
79 76
80 void CommandLinePrefStore::ApplyProxyMode() { 77 void CommandLinePrefStore::ApplyProxyMode() {
81 if (command_line_->HasSwitch(switches::kNoProxyServer)) { 78 if (command_line_->HasSwitch(switches::kNoProxyServer)) {
82 SetValue(prefs::kProxyMode, 79 SetValue(prefs::kProxy,
83 Value::CreateIntegerValue(ProxyPrefs::MODE_DIRECT)); 80 ProxyConfigDictionary::CreateDirect());
84 } else if (command_line_->HasSwitch(switches::kProxyPacUrl)) { 81 } else if (command_line_->HasSwitch(switches::kProxyPacUrl)) {
85 SetValue(prefs::kProxyMode, 82 std::string pac_script_url =
86 Value::CreateIntegerValue(ProxyPrefs::MODE_PAC_SCRIPT)); 83 command_line_->GetSwitchValueASCII(switches::kProxyPacUrl);
84 SetValue(prefs::kProxy,
85 ProxyConfigDictionary::CreatePacScript(pac_script_url));
87 } else if (command_line_->HasSwitch(switches::kProxyAutoDetect)) { 86 } else if (command_line_->HasSwitch(switches::kProxyAutoDetect)) {
88 SetValue(prefs::kProxyMode, 87 SetValue(prefs::kProxy,
89 Value::CreateIntegerValue(ProxyPrefs::MODE_AUTO_DETECT)); 88 ProxyConfigDictionary::CreateAutoDetect());
90 } else if (command_line_->HasSwitch(switches::kProxyServer)) { 89 } else if (command_line_->HasSwitch(switches::kProxyServer)) {
91 SetValue(prefs::kProxyMode, 90 std::string proxy_server =
92 Value::CreateIntegerValue(ProxyPrefs::MODE_FIXED_SERVERS)); 91 command_line_->GetSwitchValueASCII(switches::kProxyServer);
92 std::string bypass_list =
93 command_line_->GetSwitchValueASCII(switches::kProxyBypassList);
94 SetValue(prefs::kProxy,
95 ProxyConfigDictionary::CreateFixedServers(proxy_server,
96 bypass_list));
93 } 97 }
94 } 98 }
OLDNEW
« no previous file with comments | « chrome/browser/policy/managed_prefs_banner_base.cc ('k') | chrome/browser/prefs/command_line_pref_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698