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)); |
+ } |
+} |