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

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

Issue 372103006: Stamp out CreateStringValue in chrome/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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) 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 << switches::kNoProxyServer << " was also specified."; 91 << switches::kNoProxyServer << " was also specified.";
92 return false; 92 return false;
93 } 93 }
94 return true; 94 return true;
95 } 95 }
96 96
97 void CommandLinePrefStore::ApplySimpleSwitches() { 97 void CommandLinePrefStore::ApplySimpleSwitches() {
98 // Look for each switch we know about and set its preference accordingly. 98 // Look for each switch we know about and set its preference accordingly.
99 for (size_t i = 0; i < arraysize(string_switch_map_); ++i) { 99 for (size_t i = 0; i < arraysize(string_switch_map_); ++i) {
100 if (command_line_->HasSwitch(string_switch_map_[i].switch_name)) { 100 if (command_line_->HasSwitch(string_switch_map_[i].switch_name)) {
101 base::Value* value = base::Value::CreateStringValue(command_line_-> 101 SetValue(string_switch_map_[i].preference_path,
102 GetSwitchValueASCII(string_switch_map_[i].switch_name)); 102 new base::StringValue(command_line_->GetSwitchValueASCII(
103 SetValue(string_switch_map_[i].preference_path, value); 103 string_switch_map_[i].switch_name)));
104 } 104 }
105 } 105 }
106 106
107 for (size_t i = 0; i < arraysize(integer_switch_map_); ++i) { 107 for (size_t i = 0; i < arraysize(integer_switch_map_); ++i) {
108 if (command_line_->HasSwitch(integer_switch_map_[i].switch_name)) { 108 if (command_line_->HasSwitch(integer_switch_map_[i].switch_name)) {
109 std::string str_value = command_line_->GetSwitchValueASCII( 109 std::string str_value = command_line_->GetSwitchValueASCII(
110 integer_switch_map_[i].switch_name); 110 integer_switch_map_[i].switch_name);
111 int int_value = 0; 111 int int_value = 0;
112 if (!base::StringToInt(str_value, &int_value)) { 112 if (!base::StringToInt(str_value, &int_value)) {
113 LOG(ERROR) << "The value " << str_value << " of " 113 LOG(ERROR) << "The value " << str_value << " of "
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 154
155 void CommandLinePrefStore::ApplySSLSwitches() { 155 void CommandLinePrefStore::ApplySSLSwitches() {
156 if (command_line_->HasSwitch(switches::kCipherSuiteBlacklist)) { 156 if (command_line_->HasSwitch(switches::kCipherSuiteBlacklist)) {
157 std::string cipher_suites = 157 std::string cipher_suites =
158 command_line_->GetSwitchValueASCII(switches::kCipherSuiteBlacklist); 158 command_line_->GetSwitchValueASCII(switches::kCipherSuiteBlacklist);
159 std::vector<std::string> cipher_strings; 159 std::vector<std::string> cipher_strings;
160 base::SplitString(cipher_suites, ',', &cipher_strings); 160 base::SplitString(cipher_suites, ',', &cipher_strings);
161 base::ListValue* list_value = new base::ListValue(); 161 base::ListValue* list_value = new base::ListValue();
162 for (std::vector<std::string>::const_iterator it = cipher_strings.begin(); 162 for (std::vector<std::string>::const_iterator it = cipher_strings.begin();
163 it != cipher_strings.end(); ++it) { 163 it != cipher_strings.end(); ++it) {
164 list_value->Append(base::Value::CreateStringValue(*it)); 164 list_value->Append(new base::StringValue(*it));
165 } 165 }
166 SetValue(prefs::kCipherSuiteBlacklist, list_value); 166 SetValue(prefs::kCipherSuiteBlacklist, list_value);
167 } 167 }
168 } 168 }
169 169
170 void CommandLinePrefStore::ApplyBackgroundModeSwitches() { 170 void CommandLinePrefStore::ApplyBackgroundModeSwitches() {
171 if (command_line_->HasSwitch(switches::kDisableExtensions)) { 171 if (command_line_->HasSwitch(switches::kDisableExtensions)) {
172 base::Value* value = base::Value::CreateBooleanValue(false); 172 base::Value* value = base::Value::CreateBooleanValue(false);
173 SetValue(prefs::kBackgroundModeEnabled, value); 173 SetValue(prefs::kBackgroundModeEnabled, value);
174 } 174 }
175 } 175 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698