| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 13 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
| 14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 16 #include "components/policy/core/browser/policy_error_map.h" | 16 #include "components/policy/core/browser/policy_error_map.h" |
| 17 #include "components/policy/core/common/policy_map.h" | 17 #include "components/policy/core/common/policy_map.h" |
| 18 #include "components/policy/policy_constants.h" |
| 18 #include "components/prefs/pref_value_map.h" | 19 #include "components/prefs/pref_value_map.h" |
| 19 #include "components/search_engines/default_search_manager.h" | 20 #include "components/search_engines/default_search_manager.h" |
| 20 #include "components/search_engines/search_engines_pref_names.h" | 21 #include "components/search_engines/search_engines_pref_names.h" |
| 21 #include "components/search_engines/search_terms_data.h" | 22 #include "components/search_engines/search_terms_data.h" |
| 22 #include "components/search_engines/template_url.h" | 23 #include "components/search_engines/template_url.h" |
| 23 #include "grit/components_strings.h" | 24 #include "grit/components_strings.h" |
| 24 #include "policy/policy_constants.h" | |
| 25 | 25 |
| 26 namespace policy { | 26 namespace policy { |
| 27 | 27 |
| 28 namespace { | 28 namespace { |
| 29 // Extracts a list from a policy value and adds it to a pref dictionary. | 29 // Extracts a list from a policy value and adds it to a pref dictionary. |
| 30 void SetListInPref(const PolicyMap& policies, | 30 void SetListInPref(const PolicyMap& policies, |
| 31 const char* policy_name, | 31 const char* policy_name, |
| 32 const char* key, | 32 const char* key, |
| 33 base::DictionaryValue* dict) { | 33 base::DictionaryValue* dict) { |
| 34 DCHECK(dict); | 34 DCHECK(dict); |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 void DefaultSearchPolicyHandler::EnsureListPrefExists( | 366 void DefaultSearchPolicyHandler::EnsureListPrefExists( |
| 367 PrefValueMap* prefs, | 367 PrefValueMap* prefs, |
| 368 const std::string& path) { | 368 const std::string& path) { |
| 369 base::Value* value; | 369 base::Value* value; |
| 370 base::ListValue* list_value; | 370 base::ListValue* list_value; |
| 371 if (!prefs->GetValue(path, &value) || !value->GetAsList(&list_value)) | 371 if (!prefs->GetValue(path, &value) || !value->GetAsList(&list_value)) |
| 372 prefs->SetValue(path, base::WrapUnique(new base::ListValue())); | 372 prefs->SetValue(path, base::WrapUnique(new base::ListValue())); |
| 373 } | 373 } |
| 374 | 374 |
| 375 } // namespace policy | 375 } // namespace policy |
| OLD | NEW |