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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 101 |
102 // Gets the source of the current Default Search Engine value. | 102 // Gets the source of the current Default Search Engine value. |
103 Source GetDefaultSearchEngineSource() const; | 103 Source GetDefaultSearchEngineSource() const; |
104 | 104 |
105 // Returns a pointer to the fallback engine. | 105 // Returns a pointer to the fallback engine. |
106 const TemplateURLData* GetFallbackSearchEngine() const; | 106 const TemplateURLData* GetFallbackSearchEngine() const; |
107 | 107 |
108 // Write default search provider data to |pref_service_|. | 108 // Write default search provider data to |pref_service_|. |
109 void SetUserSelectedDefaultSearchEngine(const TemplateURLData& data); | 109 void SetUserSelectedDefaultSearchEngine(const TemplateURLData& data); |
110 | 110 |
111 // Override the default search provider with an extension. | |
112 void SetExtensionControlledDefaultSearchEngine(const TemplateURLData& data); | |
113 | |
114 // Clear the extension-provided default search engine. Does not explicitly | |
115 // disable Default Search. The new current default search engine will be | |
116 // defined by policy, extensions, or pre-populated data. | |
117 void ClearExtensionControlledDefaultSearchEngine(); | |
118 | |
119 // Clear the user's default search provider choice from |pref_service_|. Does | 111 // Clear the user's default search provider choice from |pref_service_|. Does |
120 // not explicitly disable Default Search. The new default search | 112 // not explicitly disable Default Search. The new default search |
121 // engine will be defined by policy, extensions, or pre-populated data. | 113 // engine will be defined by policy, extensions, or pre-populated data. |
122 void ClearUserSelectedDefaultSearchEngine(); | 114 void ClearUserSelectedDefaultSearchEngine(); |
123 | 115 |
124 private: | 116 private: |
125 // Handles changes to kDefaultSearchProviderData pref. This includes sync and | 117 // Handles changes to kDefaultSearchProviderData pref. This includes sync and |
126 // policy changes. Calls LoadDefaultSearchEngineFromPrefs() and | 118 // policy changes. Calls LoadDefaultSearchEngineFromPrefs() and |
127 // NotifyObserver() if the effective DSE might have changed. | 119 // NotifyObserver() if the effective DSE might have changed. |
128 void OnDefaultSearchPrefChanged(); | 120 void OnDefaultSearchPrefChanged(); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 // prefs). This will be null if no value was set in the pref store. | 159 // prefs). This will be null if no value was set in the pref store. |
168 std::unique_ptr<TemplateURLData> prefs_default_search_; | 160 std::unique_ptr<TemplateURLData> prefs_default_search_; |
169 | 161 |
170 // True if the default search is currently enforced by policy. | 162 // True if the default search is currently enforced by policy. |
171 bool default_search_controlled_by_policy_; | 163 bool default_search_controlled_by_policy_; |
172 | 164 |
173 DISALLOW_COPY_AND_ASSIGN(DefaultSearchManager); | 165 DISALLOW_COPY_AND_ASSIGN(DefaultSearchManager); |
174 }; | 166 }; |
175 | 167 |
176 #endif // COMPONENTS_SEARCH_ENGINES_DEFAULT_SEARCH_MANAGER_H_ | 168 #endif // COMPONENTS_SEARCH_ENGINES_DEFAULT_SEARCH_MANAGER_H_ |
OLD | NEW |