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

Unified Diff: chrome/browser/prefs/command_line_pref_store.cc

Issue 6004003: Introduce a separate preference for 'proxy server mode' (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit - alphabetize Created 10 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/prefs/command_line_pref_store.cc
diff --git a/chrome/browser/prefs/command_line_pref_store.cc b/chrome/browser/prefs/command_line_pref_store.cc
index ae70d97c1961f79425c9a8d162acc5fad1561fe1..4a386d64f719fa1bf789a4216f7afcbd1b42cf03 100644
--- a/chrome/browser/prefs/command_line_pref_store.cc
+++ b/chrome/browser/prefs/command_line_pref_store.cc
@@ -7,6 +7,7 @@
#include "app/app_switches.h"
#include "base/logging.h"
#include "base/values.h"
+#include "chrome/browser/prefs/proxy_prefs.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
@@ -25,8 +26,6 @@ const CommandLinePrefStore::StringSwitchToPreferenceMapEntry
const CommandLinePrefStore::BooleanSwitchToPreferenceMapEntry
CommandLinePrefStore::boolean_switch_map_[] = {
- { switches::kNoProxyServer, prefs::kNoProxyServer, true },
- { switches::kProxyAutoDetect, prefs::kProxyAutoDetect, true },
{ switches::kDisableAuthNegotiateCnameLookup,
prefs::kDisableAuthNegotiateCnameLookup, true },
{ switches::kEnableAuthNegotiatePort, prefs::kEnableAuthNegotiatePort,
@@ -37,6 +36,7 @@ const CommandLinePrefStore::BooleanSwitchToPreferenceMapEntry
CommandLinePrefStore::CommandLinePrefStore(const CommandLine* command_line)
: command_line_(command_line) {
ApplySimpleSwitches();
+ ApplyProxyMode();
ValidateProxySwitches();
}
@@ -73,3 +73,19 @@ bool CommandLinePrefStore::ValidateProxySwitches() {
}
return true;
}
+
+void CommandLinePrefStore::ApplyProxyMode() {
+ if (command_line_->HasSwitch(switches::kNoProxyServer)) {
+ SetValue(prefs::kProxyMode,
+ Value::CreateIntegerValue(ProxyPrefs::MODE_DIRECT));
+ } else if (command_line_->HasSwitch(switches::kProxyPacUrl)) {
+ SetValue(prefs::kProxyMode,
+ Value::CreateIntegerValue(ProxyPrefs::MODE_PAC_SCRIPT));
+ } else if (command_line_->HasSwitch(switches::kProxyAutoDetect)) {
+ SetValue(prefs::kProxyMode,
+ Value::CreateIntegerValue(ProxyPrefs::MODE_AUTO_DETECT));
+ } else if (command_line_->HasSwitch(switches::kProxyServer)) {
+ SetValue(prefs::kProxyMode,
+ Value::CreateIntegerValue(ProxyPrefs::MODE_FIXED_SERVERS));
+ }
+}
« no previous file with comments | « chrome/browser/prefs/command_line_pref_store.h ('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