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