| 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 #ifndef COMPONENTS_SEARCH_ENGINES_DEFAULT_SEARCH_MANAGER_H_ | 5 #ifndef COMPONENTS_SEARCH_ENGINES_DEFAULT_SEARCH_MANAGER_H_ |
| 6 #define COMPONENTS_SEARCH_ENGINES_DEFAULT_SEARCH_MANAGER_H_ | 6 #define COMPONENTS_SEARCH_ENGINES_DEFAULT_SEARCH_MANAGER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // that Default Search is explicitly disabled. |source|, if not NULL, will be | 90 // that Default Search is explicitly disabled. |source|, if not NULL, will be |
| 91 // filled in with the source of the result. | 91 // filled in with the source of the result. |
| 92 TemplateURLData* GetDefaultSearchEngine(Source* source) const; | 92 TemplateURLData* GetDefaultSearchEngine(Source* source) const; |
| 93 | 93 |
| 94 // Gets the source of the current Default Search Engine value. | 94 // Gets the source of the current Default Search Engine value. |
| 95 Source GetDefaultSearchEngineSource() const; | 95 Source GetDefaultSearchEngineSource() const; |
| 96 | 96 |
| 97 // Write default search provider data to |pref_service_|. | 97 // Write default search provider data to |pref_service_|. |
| 98 void SetUserSelectedDefaultSearchEngine(const TemplateURLData& data); | 98 void SetUserSelectedDefaultSearchEngine(const TemplateURLData& data); |
| 99 | 99 |
| 100 // Override the default search provider with an extension. | |
| 101 void SetExtensionControlledDefaultSearchEngine(const TemplateURLData& data); | |
| 102 | |
| 103 // Clear the extension-provided default search engine. Does not explicitly | |
| 104 // disable Default Search. The new current default search engine will be | |
| 105 // defined by policy, extensions, or pre-populated data. | |
| 106 void ClearExtensionControlledDefaultSearchEngine(); | |
| 107 | |
| 108 // Clear the user's default search provider choice from |pref_service_|. Does | 100 // Clear the user's default search provider choice from |pref_service_|. Does |
| 109 // not explicitly disable Default Search. The new default search | 101 // not explicitly disable Default Search. The new default search |
| 110 // engine will be defined by policy, extensions, or pre-populated data. | 102 // engine will be defined by policy, extensions, or pre-populated data. |
| 111 void ClearUserSelectedDefaultSearchEngine(); | 103 void ClearUserSelectedDefaultSearchEngine(); |
| 112 | 104 |
| 113 private: | 105 private: |
| 114 // Handles changes to kDefaultSearchProviderData pref. This includes sync and | 106 // Handles changes to kDefaultSearchProviderData pref. This includes sync and |
| 115 // policy changes. Calls LoadDefaultSearchEngineFromPrefs() and | 107 // policy changes. Calls LoadDefaultSearchEngineFromPrefs() and |
| 116 // NotifyObserver() if the effective DSE might have changed. | 108 // NotifyObserver() if the effective DSE might have changed. |
| 117 void OnDefaultSearchPrefChanged(); | 109 void OnDefaultSearchPrefChanged(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 // prefs). This will be null if no value was set in the pref store. | 148 // prefs). This will be null if no value was set in the pref store. |
| 157 std::unique_ptr<TemplateURLData> prefs_default_search_; | 149 std::unique_ptr<TemplateURLData> prefs_default_search_; |
| 158 | 150 |
| 159 // True if the default search is currently enforced by policy. | 151 // True if the default search is currently enforced by policy. |
| 160 bool default_search_controlled_by_policy_; | 152 bool default_search_controlled_by_policy_; |
| 161 | 153 |
| 162 DISALLOW_COPY_AND_ASSIGN(DefaultSearchManager); | 154 DISALLOW_COPY_AND_ASSIGN(DefaultSearchManager); |
| 163 }; | 155 }; |
| 164 | 156 |
| 165 #endif // COMPONENTS_SEARCH_ENGINES_DEFAULT_SEARCH_MANAGER_H_ | 157 #endif // COMPONENTS_SEARCH_ENGINES_DEFAULT_SEARCH_MANAGER_H_ |
| OLD | NEW |