| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_pref_store.h" | 5 #include "chrome/browser/policy/configuration_policy_pref_store.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 11 #include "base/string16.h" | 11 #include "base/string16.h" |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/policy/configuration_policy_provider.h" | 16 #include "chrome/browser/policy/configuration_policy_provider.h" |
| 17 #if defined(OS_WIN) | 17 #if defined(OS_WIN) |
| 18 #include "chrome/browser/policy/configuration_policy_provider_win.h" | 18 #include "chrome/browser/policy/configuration_policy_provider_win.h" |
| 19 #elif defined(OS_MACOSX) | 19 #elif defined(OS_MACOSX) |
| 20 #include "chrome/browser/policy/configuration_policy_provider_mac.h" | 20 #include "chrome/browser/policy/configuration_policy_provider_mac.h" |
| 21 #elif defined(OS_POSIX) | 21 #elif defined(OS_POSIX) |
| 22 #include "chrome/browser/policy/config_dir_policy_provider.h" | 22 #include "chrome/browser/policy/config_dir_policy_provider.h" |
| 23 #endif | 23 #endif |
| 24 #include "chrome/browser/policy/device_management_policy_provider.h" | 24 #include "chrome/browser/policy/device_management_policy_provider.h" |
| 25 #include "chrome/browser/policy/dummy_configuration_policy_provider.h" | 25 #include "chrome/browser/policy/dummy_configuration_policy_provider.h" |
| 26 #include "chrome/browser/policy/profile_policy_context.h" | 26 #include "chrome/browser/policy/profile_policy_context.h" |
| 27 #include "chrome/browser/search_engines/search_terms_data.h" | 27 #include "chrome/browser/search_engines/search_terms_data.h" |
| 28 #include "chrome/browser/search_engines/template_url.h" | 28 #include "chrome/browser/search_engines/template_url.h" |
| 29 #include "chrome/common/chrome_paths.h" | 29 #include "chrome/common/chrome_paths.h" |
| 30 #include "chrome/common/chrome_switches.h" | |
| 31 #include "chrome/common/policy_constants.h" | 30 #include "chrome/common/policy_constants.h" |
| 32 #include "chrome/common/pref_names.h" | 31 #include "chrome/common/pref_names.h" |
| 33 | 32 |
| 34 namespace policy { | 33 namespace policy { |
| 35 | 34 |
| 36 // Manages the lifecycle of the shared platform-specific policy providers for | 35 // Manages the lifecycle of the shared platform-specific policy providers for |
| 37 // managed platform, device management and recommended policy. Instantiated as a | 36 // managed platform, device management and recommended policy. Instantiated as a |
| 38 // Singleton. | 37 // Singleton. |
| 39 class ConfigurationPolicyProviderKeeper { | 38 class ConfigurationPolicyProviderKeeper { |
| 40 public: | 39 public: |
| (...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 } | 616 } |
| 618 #if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD) | 617 #if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD) |
| 619 virtual std::wstring GetRlzParameterValue() const { | 618 virtual std::wstring GetRlzParameterValue() const { |
| 620 return std::wstring(); | 619 return std::wstring(); |
| 621 } | 620 } |
| 622 #endif | 621 #endif |
| 623 private: | 622 private: |
| 624 DISALLOW_COPY_AND_ASSIGN(SearchTermsDataForValidation); | 623 DISALLOW_COPY_AND_ASSIGN(SearchTermsDataForValidation); |
| 625 }; | 624 }; |
| 626 | 625 |
| 627 } // namepsace | 626 } // namespace |
| 628 | 627 |
| 629 void ConfigurationPolicyPrefStore::FinalizeDefaultSearchPolicySettings() { | 628 void ConfigurationPolicyPrefStore::FinalizeDefaultSearchPolicySettings() { |
| 630 bool enabled = true; | 629 bool enabled = true; |
| 631 if (prefs_->GetBoolean(prefs::kDefaultSearchProviderEnabled, &enabled) && | 630 if (prefs_->GetBoolean(prefs::kDefaultSearchProviderEnabled, &enabled) && |
| 632 !enabled) { | 631 !enabled) { |
| 633 // If default search is disabled, we ignore the other fields. | 632 // If default search is disabled, we ignore the other fields. |
| 634 prefs_->SetString(prefs::kDefaultSearchProviderName, std::string()); | 633 prefs_->SetString(prefs::kDefaultSearchProviderName, std::string()); |
| 635 prefs_->SetString(prefs::kDefaultSearchProviderSearchURL, std::string()); | 634 prefs_->SetString(prefs::kDefaultSearchProviderSearchURL, std::string()); |
| 636 prefs_->SetString(prefs::kDefaultSearchProviderSuggestURL, std::string()); | 635 prefs_->SetString(prefs::kDefaultSearchProviderSuggestURL, std::string()); |
| 637 prefs_->SetString(prefs::kDefaultSearchProviderIconURL, std::string()); | 636 prefs_->SetString(prefs::kDefaultSearchProviderIconURL, std::string()); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 667 std::string()); | 666 std::string()); |
| 668 return; | 667 return; |
| 669 } | 668 } |
| 670 } | 669 } |
| 671 // Required entries are not there. Remove any related entries. | 670 // Required entries are not there. Remove any related entries. |
| 672 RemovePreferencesOfMap(kDefaultSearchPolicyMap, | 671 RemovePreferencesOfMap(kDefaultSearchPolicyMap, |
| 673 arraysize(kDefaultSearchPolicyMap)); | 672 arraysize(kDefaultSearchPolicyMap)); |
| 674 } | 673 } |
| 675 | 674 |
| 676 } // namespace policy | 675 } // namespace policy |
| OLD | NEW |