OLD | NEW |
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/policy/configuration_policy_handler.h" | 5 #include "chrome/browser/policy/configuration_policy_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 errors->AddError(key::kDefaultSearchProviderSearchURL, | 507 errors->AddError(key::kDefaultSearchProviderSearchURL, |
508 IDS_POLICY_INVALID_SEARCH_URL_ERROR); | 508 IDS_POLICY_INVALID_SEARCH_URL_ERROR); |
509 return false; | 509 return false; |
510 } | 510 } |
511 return true; | 511 return true; |
512 } | 512 } |
513 | 513 |
514 void DefaultSearchPolicyHandler::ApplyPolicySettings(const PolicyMap& policies, | 514 void DefaultSearchPolicyHandler::ApplyPolicySettings(const PolicyMap& policies, |
515 PrefValueMap* prefs) { | 515 PrefValueMap* prefs) { |
516 if (DefaultSearchProviderIsDisabled(policies)) { | 516 if (DefaultSearchProviderIsDisabled(policies)) { |
| 517 prefs->SetBoolean(prefs::kDefaultSearchProviderEnabled, false); |
| 518 |
517 // If default search is disabled, the other fields are ignored. | 519 // If default search is disabled, the other fields are ignored. |
518 prefs->SetString(prefs::kDefaultSearchProviderName, std::string()); | 520 prefs->SetString(prefs::kDefaultSearchProviderName, std::string()); |
519 prefs->SetString(prefs::kDefaultSearchProviderSearchURL, std::string()); | 521 prefs->SetString(prefs::kDefaultSearchProviderSearchURL, std::string()); |
520 prefs->SetString(prefs::kDefaultSearchProviderSuggestURL, std::string()); | 522 prefs->SetString(prefs::kDefaultSearchProviderSuggestURL, std::string()); |
521 prefs->SetString(prefs::kDefaultSearchProviderIconURL, std::string()); | 523 prefs->SetString(prefs::kDefaultSearchProviderIconURL, std::string()); |
522 prefs->SetString(prefs::kDefaultSearchProviderEncodings, std::string()); | 524 prefs->SetString(prefs::kDefaultSearchProviderEncodings, std::string()); |
523 prefs->SetString(prefs::kDefaultSearchProviderKeyword, std::string()); | 525 prefs->SetString(prefs::kDefaultSearchProviderKeyword, std::string()); |
524 prefs->SetString(prefs::kDefaultSearchProviderInstantURL, std::string()); | 526 prefs->SetString(prefs::kDefaultSearchProviderInstantURL, std::string()); |
525 return; | 527 return; |
526 } | 528 } |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
961 } | 963 } |
962 } | 964 } |
963 | 965 |
964 if (setting != CONTENT_SETTING_DEFAULT) { | 966 if (setting != CONTENT_SETTING_DEFAULT) { |
965 prefs->SetValue(prefs::kManagedDefaultJavaScriptSetting, | 967 prefs->SetValue(prefs::kManagedDefaultJavaScriptSetting, |
966 Value::CreateIntegerValue(setting)); | 968 Value::CreateIntegerValue(setting)); |
967 } | 969 } |
968 } | 970 } |
969 | 971 |
970 } // namespace policy | 972 } // namespace policy |
OLD | NEW |