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

Side by Side Diff: components/search_engines/default_search_policy_handler.cc

Issue 388963002: Get rid of the rest of CreateStringValue (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix bad rebase 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/search_engines/default_search_policy_handler.h" 5 #include "components/search_engines/default_search_policy_handler.h"
6 6
7 #include "base/prefs/pref_value_map.h" 7 #include "base/prefs/pref_value_map.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 base::ListValue::const_iterator iter(list->begin()); 163 base::ListValue::const_iterator iter(list->begin());
164 base::ListValue::const_iterator end(list->end()); 164 base::ListValue::const_iterator end(list->end());
165 std::vector<std::string> string_parts; 165 std::vector<std::string> string_parts;
166 for (; iter != end; ++iter) { 166 for (; iter != end; ++iter) {
167 std::string s; 167 std::string s;
168 if ((*iter)->GetAsString(&s)) { 168 if ((*iter)->GetAsString(&s)) {
169 string_parts.push_back(s); 169 string_parts.push_back(s);
170 } 170 }
171 } 171 }
172 std::string encodings = JoinString(string_parts, ';'); 172 std::string encodings = JoinString(string_parts, ';');
173 prefs->SetValue(prefs::kDefaultSearchProviderEncodings, 173 prefs->SetString(prefs::kDefaultSearchProviderEncodings, encodings);
174 base::Value::CreateStringValue(encodings));
175 } 174 }
176 175
177 176
178 // DefaultSearchPolicyHandler implementation ----------------------------------- 177 // DefaultSearchPolicyHandler implementation -----------------------------------
179 178
180 DefaultSearchPolicyHandler::DefaultSearchPolicyHandler() { 179 DefaultSearchPolicyHandler::DefaultSearchPolicyHandler() {
181 for (size_t i = 0; i < arraysize(kDefaultSearchPolicyMap); ++i) { 180 for (size_t i = 0; i < arraysize(kDefaultSearchPolicyMap); ++i) {
182 const char* policy_name = kDefaultSearchPolicyMap[i].policy_name; 181 const char* policy_name = kDefaultSearchPolicyMap[i].policy_name;
183 if (policy_name == key::kDefaultSearchProviderEncodings) { 182 if (policy_name == key::kDefaultSearchProviderEncodings) {
184 handlers_.push_back(new DefaultSearchEncodingsPolicyHandler()); 183 handlers_.push_back(new DefaultSearchEncodingsPolicyHandler());
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 void DefaultSearchPolicyHandler::EnsureListPrefExists( 451 void DefaultSearchPolicyHandler::EnsureListPrefExists(
453 PrefValueMap* prefs, 452 PrefValueMap* prefs,
454 const std::string& path) { 453 const std::string& path) {
455 base::Value* value; 454 base::Value* value;
456 base::ListValue* list_value; 455 base::ListValue* list_value;
457 if (!prefs->GetValue(path, &value) || !value->GetAsList(&list_value)) 456 if (!prefs->GetValue(path, &value) || !value->GetAsList(&list_value))
458 prefs->SetValue(path, new base::ListValue()); 457 prefs->SetValue(path, new base::ListValue());
459 } 458 }
460 459
461 } // namespace policy 460 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698