OLD | NEW |
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/command_line_pref_store.h" | 5 #include "chrome/browser/prefs/command_line_pref_store.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 << switches::kNoProxyServer << " was also specified."; | 104 << switches::kNoProxyServer << " was also specified."; |
105 return false; | 105 return false; |
106 } | 106 } |
107 return true; | 107 return true; |
108 } | 108 } |
109 | 109 |
110 void CommandLinePrefStore::ApplySimpleSwitches() { | 110 void CommandLinePrefStore::ApplySimpleSwitches() { |
111 // Look for each switch we know about and set its preference accordingly. | 111 // Look for each switch we know about and set its preference accordingly. |
112 for (size_t i = 0; i < arraysize(string_switch_map_); ++i) { | 112 for (size_t i = 0; i < arraysize(string_switch_map_); ++i) { |
113 if (command_line_->HasSwitch(string_switch_map_[i].switch_name)) { | 113 if (command_line_->HasSwitch(string_switch_map_[i].switch_name)) { |
114 Value* value = Value::CreateStringValue(command_line_-> | 114 base::Value* value = base::Value::CreateStringValue(command_line_-> |
115 GetSwitchValueASCII(string_switch_map_[i].switch_name)); | 115 GetSwitchValueASCII(string_switch_map_[i].switch_name)); |
116 SetValue(string_switch_map_[i].preference_path, value); | 116 SetValue(string_switch_map_[i].preference_path, value); |
117 } | 117 } |
118 } | 118 } |
119 | 119 |
120 for (size_t i = 0; i < arraysize(integer_switch_map_); ++i) { | 120 for (size_t i = 0; i < arraysize(integer_switch_map_); ++i) { |
121 if (command_line_->HasSwitch(integer_switch_map_[i].switch_name)) { | 121 if (command_line_->HasSwitch(integer_switch_map_[i].switch_name)) { |
122 std::string str_value = command_line_->GetSwitchValueASCII( | 122 std::string str_value = command_line_->GetSwitchValueASCII( |
123 integer_switch_map_[i].switch_name); | 123 integer_switch_map_[i].switch_name); |
124 int int_value = 0; | 124 int int_value = 0; |
125 if (!base::StringToInt(str_value, &int_value)) { | 125 if (!base::StringToInt(str_value, &int_value)) { |
126 LOG(ERROR) << "The value " << str_value << " of " | 126 LOG(ERROR) << "The value " << str_value << " of " |
127 << integer_switch_map_[i].switch_name | 127 << integer_switch_map_[i].switch_name |
128 << " can not be converted to integer, ignoring!"; | 128 << " can not be converted to integer, ignoring!"; |
129 continue; | 129 continue; |
130 } | 130 } |
131 Value* value = Value::CreateIntegerValue(int_value); | 131 base::Value* value = base::Value::CreateIntegerValue(int_value); |
132 SetValue(integer_switch_map_[i].preference_path, value); | 132 SetValue(integer_switch_map_[i].preference_path, value); |
133 } | 133 } |
134 } | 134 } |
135 | 135 |
136 for (size_t i = 0; i < arraysize(boolean_switch_map_); ++i) { | 136 for (size_t i = 0; i < arraysize(boolean_switch_map_); ++i) { |
137 if (command_line_->HasSwitch(boolean_switch_map_[i].switch_name)) { | 137 if (command_line_->HasSwitch(boolean_switch_map_[i].switch_name)) { |
138 Value* value = Value::CreateBooleanValue( | 138 base::Value* value = base::Value::CreateBooleanValue( |
139 boolean_switch_map_[i].set_value); | 139 boolean_switch_map_[i].set_value); |
140 SetValue(boolean_switch_map_[i].preference_path, value); | 140 SetValue(boolean_switch_map_[i].preference_path, value); |
141 } | 141 } |
142 } | 142 } |
143 } | 143 } |
144 | 144 |
145 void CommandLinePrefStore::ApplyProxyMode() { | 145 void CommandLinePrefStore::ApplyProxyMode() { |
146 if (command_line_->HasSwitch(switches::kNoProxyServer)) { | 146 if (command_line_->HasSwitch(switches::kNoProxyServer)) { |
147 SetValue(prefs::kProxy, | 147 SetValue(prefs::kProxy, |
148 ProxyConfigDictionary::CreateDirect()); | 148 ProxyConfigDictionary::CreateDirect()); |
(...skipping 27 matching lines...) Expand all Loading... |
176 it != cipher_strings.end(); ++it) { | 176 it != cipher_strings.end(); ++it) { |
177 list_value->Append(base::Value::CreateStringValue(*it)); | 177 list_value->Append(base::Value::CreateStringValue(*it)); |
178 } | 178 } |
179 SetValue(prefs::kCipherSuiteBlacklist, list_value); | 179 SetValue(prefs::kCipherSuiteBlacklist, list_value); |
180 } | 180 } |
181 } | 181 } |
182 | 182 |
183 void CommandLinePrefStore::ApplyBackgroundModeSwitches() { | 183 void CommandLinePrefStore::ApplyBackgroundModeSwitches() { |
184 if (command_line_->HasSwitch(switches::kDisableBackgroundMode) || | 184 if (command_line_->HasSwitch(switches::kDisableBackgroundMode) || |
185 command_line_->HasSwitch(switches::kDisableExtensions)) { | 185 command_line_->HasSwitch(switches::kDisableExtensions)) { |
186 Value* value = Value::CreateBooleanValue(false); | 186 base::Value* value = base::Value::CreateBooleanValue(false); |
187 SetValue(prefs::kBackgroundModeEnabled, value); | 187 SetValue(prefs::kBackgroundModeEnabled, value); |
188 } | 188 } |
189 } | 189 } |
OLD | NEW |