OLD | NEW |
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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 162 |
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 = base::JoinString(string_parts, ";"); |
173 prefs->SetString(prefs::kDefaultSearchProviderEncodings, encodings); | 173 prefs->SetString(prefs::kDefaultSearchProviderEncodings, encodings); |
174 } | 174 } |
175 | 175 |
176 | 176 |
177 // DefaultSearchPolicyHandler implementation ----------------------------------- | 177 // DefaultSearchPolicyHandler implementation ----------------------------------- |
178 | 178 |
179 DefaultSearchPolicyHandler::DefaultSearchPolicyHandler() { | 179 DefaultSearchPolicyHandler::DefaultSearchPolicyHandler() { |
180 for (size_t i = 0; i < arraysize(kDefaultSearchPolicyMap); ++i) { | 180 for (size_t i = 0; i < arraysize(kDefaultSearchPolicyMap); ++i) { |
181 const char* policy_name = kDefaultSearchPolicyMap[i].policy_name; | 181 const char* policy_name = kDefaultSearchPolicyMap[i].policy_name; |
182 if (policy_name == key::kDefaultSearchProviderEncodings) { | 182 if (policy_name == key::kDefaultSearchProviderEncodings) { |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 void DefaultSearchPolicyHandler::EnsureListPrefExists( | 360 void DefaultSearchPolicyHandler::EnsureListPrefExists( |
361 PrefValueMap* prefs, | 361 PrefValueMap* prefs, |
362 const std::string& path) { | 362 const std::string& path) { |
363 base::Value* value; | 363 base::Value* value; |
364 base::ListValue* list_value; | 364 base::ListValue* list_value; |
365 if (!prefs->GetValue(path, &value) || !value->GetAsList(&list_value)) | 365 if (!prefs->GetValue(path, &value) || !value->GetAsList(&list_value)) |
366 prefs->SetValue(path, make_scoped_ptr(new base::ListValue())); | 366 prefs->SetValue(path, make_scoped_ptr(new base::ListValue())); |
367 } | 367 } |
368 | 368 |
369 } // namespace policy | 369 } // namespace policy |
OLD | NEW |