| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 prefs_(new DictionaryValue()) {} | 29 prefs_(new DictionaryValue()) {} |
| 30 | 30 |
| 31 CommandLinePrefStore::~CommandLinePrefStore() {} | 31 CommandLinePrefStore::~CommandLinePrefStore() {} |
| 32 | 32 |
| 33 PrefStore::PrefReadError CommandLinePrefStore::ReadPrefs() { | 33 PrefStore::PrefReadError CommandLinePrefStore::ReadPrefs() { |
| 34 ApplySimpleSwitches(); | 34 ApplySimpleSwitches(); |
| 35 ValidateProxySwitches(); | 35 ValidateProxySwitches(); |
| 36 return PrefStore::PREF_READ_ERROR_NONE; | 36 return PrefStore::PREF_READ_ERROR_NONE; |
| 37 } | 37 } |
| 38 | 38 |
| 39 DictionaryValue* CommandLinePrefStore::prefs() { return prefs_.get(); } | |
| 40 | |
| 41 void CommandLinePrefStore::ApplySimpleSwitches() { | 39 void CommandLinePrefStore::ApplySimpleSwitches() { |
| 42 // Look for each switch we know about and set its preference accordingly. | 40 // Look for each switch we know about and set its preference accordingly. |
| 43 for (size_t i = 0; i < arraysize(string_switch_map_); ++i) { | 41 for (size_t i = 0; i < arraysize(string_switch_map_); ++i) { |
| 44 if (command_line_->HasSwitch(string_switch_map_[i].switch_name)) { | 42 if (command_line_->HasSwitch(string_switch_map_[i].switch_name)) { |
| 45 Value* value = Value::CreateStringValue(command_line_-> | 43 Value* value = Value::CreateStringValue(command_line_-> |
| 46 GetSwitchValueASCII(string_switch_map_[i].switch_name)); | 44 GetSwitchValueASCII(string_switch_map_[i].switch_name)); |
| 47 prefs_->Set(string_switch_map_[i].preference_path, value); | 45 prefs_->Set(string_switch_map_[i].preference_path, value); |
| 48 } | 46 } |
| 49 } | 47 } |
| 50 | 48 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 62 (command_line_->HasSwitch(switches::kProxyAutoDetect) || | 60 (command_line_->HasSwitch(switches::kProxyAutoDetect) || |
| 63 command_line_->HasSwitch(switches::kProxyServer) || | 61 command_line_->HasSwitch(switches::kProxyServer) || |
| 64 command_line_->HasSwitch(switches::kProxyPacUrl) || | 62 command_line_->HasSwitch(switches::kProxyPacUrl) || |
| 65 command_line_->HasSwitch(switches::kProxyBypassList))) { | 63 command_line_->HasSwitch(switches::kProxyBypassList))) { |
| 66 LOG(WARNING) << "Additional command-line proxy switches specified when --" | 64 LOG(WARNING) << "Additional command-line proxy switches specified when --" |
| 67 << switches::kNoProxyServer << " was also specified."; | 65 << switches::kNoProxyServer << " was also specified."; |
| 68 return false; | 66 return false; |
| 69 } | 67 } |
| 70 return true; | 68 return true; |
| 71 } | 69 } |
| OLD | NEW |