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

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

Issue 2400703002: Fix policy checks for chrome://policy (Closed)
Patch Set: Add comment so that this doesnt get broken again Created 4 years, 2 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
« no previous file with comments | « components/policy/core/browser/configuration_policy_handler_list.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 dict->SetString(DefaultSearchManager::kShortName, host); 294 dict->SetString(DefaultSearchManager::kShortName, host);
295 if (keyword.empty()) 295 if (keyword.empty())
296 dict->SetString(DefaultSearchManager::kKeyword, host); 296 dict->SetString(DefaultSearchManager::kKeyword, host);
297 297
298 DefaultSearchManager::AddPrefValueToMap(std::move(dict), prefs); 298 DefaultSearchManager::AddPrefValueToMap(std::move(dict), prefs);
299 } 299 }
300 300
301 bool DefaultSearchPolicyHandler::CheckIndividualPolicies( 301 bool DefaultSearchPolicyHandler::CheckIndividualPolicies(
302 const PolicyMap& policies, 302 const PolicyMap& policies,
303 PolicyErrorMap* errors) { 303 PolicyErrorMap* errors) {
304 bool all_ok = true;
Peter Kasting 2016/10/10 19:39:33 Nit: I had to look at several things to understand
aberent 2016/10/13 15:10:01 Done.
304 for (const auto& handler : handlers_) { 305 for (const auto& handler : handlers_) {
305 if (!handler->CheckPolicySettings(policies, errors)) 306 if (!handler->CheckPolicySettings(policies, errors))
306 return false; 307 all_ok = false;
Peter Kasting 2016/10/10 19:39:33 Nit: Shorter: for (const auto& handler : handle
aberent 2016/10/13 15:10:01 Done.
307 } 308 }
308 return true; 309 return all_ok;
309 } 310 }
310 311
311 bool DefaultSearchPolicyHandler::HasDefaultSearchPolicy( 312 bool DefaultSearchPolicyHandler::HasDefaultSearchPolicy(
312 const PolicyMap& policies, 313 const PolicyMap& policies,
313 const char* policy_name) { 314 const char* policy_name) {
314 return policies.Get(policy_name) != NULL; 315 return policies.Get(policy_name) != NULL;
315 } 316 }
316 317
317 bool DefaultSearchPolicyHandler::AnyDefaultSearchPoliciesSpecified( 318 bool DefaultSearchPolicyHandler::AnyDefaultSearchPoliciesSpecified(
318 const PolicyMap& policies) { 319 const PolicyMap& policies) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 void DefaultSearchPolicyHandler::EnsureListPrefExists( 358 void DefaultSearchPolicyHandler::EnsureListPrefExists(
358 PrefValueMap* prefs, 359 PrefValueMap* prefs,
359 const std::string& path) { 360 const std::string& path) {
360 base::Value* value; 361 base::Value* value;
361 base::ListValue* list_value; 362 base::ListValue* list_value;
362 if (!prefs->GetValue(path, &value) || !value->GetAsList(&list_value)) 363 if (!prefs->GetValue(path, &value) || !value->GetAsList(&list_value))
363 prefs->SetValue(path, base::MakeUnique<base::ListValue>()); 364 prefs->SetValue(path, base::MakeUnique<base::ListValue>());
364 } 365 }
365 366
366 } // namespace policy 367 } // namespace policy
OLDNEW
« no previous file with comments | « components/policy/core/browser/configuration_policy_handler_list.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698