Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: components/search_engines/default_search_manager.h

Issue 2479113002: Make extensions DSE persistent in browser prefs (Closed)
Patch Set: Added DSE tests Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // that Default Search is explicitly disabled. |source|, if not NULL, will be 91 // that Default Search is explicitly disabled. |source|, if not NULL, will be
92 // filled in with the source of the result. 92 // filled in with the source of the result.
93 TemplateURLData* GetDefaultSearchEngine(Source* source) const; 93 TemplateURLData* GetDefaultSearchEngine(Source* source) const;
94 94
95 // Gets the source of the current Default Search Engine value. 95 // Gets the source of the current Default Search Engine value.
96 Source GetDefaultSearchEngineSource() const; 96 Source GetDefaultSearchEngineSource() const;
97 97
98 // Write default search provider data to |pref_service_|. 98 // Write default search provider data to |pref_service_|.
99 void SetUserSelectedDefaultSearchEngine(const TemplateURLData& data); 99 void SetUserSelectedDefaultSearchEngine(const TemplateURLData& data);
100 100
101 // Override the default search provider with an extension.
102 void SetExtensionControlledDefaultSearchEngine(const TemplateURLData& data);
103
104 // Clear the extension-provided default search engine. Does not explicitly
105 // disable Default Search. The new current default search engine will be
106 // defined by policy, extensions, or pre-populated data.
107 void ClearExtensionControlledDefaultSearchEngine();
108
109 // Clear the user's default search provider choice from |pref_service_|. Does 101 // Clear the user's default search provider choice from |pref_service_|. Does
110 // not explicitly disable Default Search. The new default search 102 // not explicitly disable Default Search. The new default search
111 // engine will be defined by policy, extensions, or pre-populated data. 103 // engine will be defined by policy, extensions, or pre-populated data.
112 void ClearUserSelectedDefaultSearchEngine(); 104 void ClearUserSelectedDefaultSearchEngine();
113 105
114 private: 106 private:
115 // Handles changes to kDefaultSearchProviderData pref. This includes sync and 107 // Handles changes to kDefaultSearchProviderData pref. This includes sync and
116 // policy changes. Calls LoadDefaultSearchEngineFromPrefs() and 108 // policy changes. Calls LoadDefaultSearchEngineFromPrefs() and
117 // NotifyObserver() if the effective DSE might have changed. 109 // NotifyObserver() if the effective DSE might have changed.
118 void OnDefaultSearchPrefChanged(); 110 void OnDefaultSearchPrefChanged();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 // prefs). This will be null if no value was set in the pref store. 149 // prefs). This will be null if no value was set in the pref store.
158 std::unique_ptr<TemplateURLData> prefs_default_search_; 150 std::unique_ptr<TemplateURLData> prefs_default_search_;
159 151
160 // True if the default search is currently enforced by policy. 152 // True if the default search is currently enforced by policy.
161 bool default_search_controlled_by_policy_; 153 bool default_search_controlled_by_policy_;
162 154
163 DISALLOW_COPY_AND_ASSIGN(DefaultSearchManager); 155 DISALLOW_COPY_AND_ASSIGN(DefaultSearchManager);
164 }; 156 };
165 157
166 #endif // COMPONENTS_SEARCH_ENGINES_DEFAULT_SEARCH_MANAGER_H_ 158 #endif // COMPONENTS_SEARCH_ENGINES_DEFAULT_SEARCH_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698