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

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

Issue 2479113002: Make extensions DSE persistent in browser prefs (Closed)
Patch Set: Fixed after review, round 7 Created 3 years, 12 months 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
110 // Clear the user's default search provider choice from |pref_service_|. Does 102 // Clear the user's default search provider choice from |pref_service_|. Does
111 // not explicitly disable Default Search. The new default search 103 // not explicitly disable Default Search. The new default search
112 // engine will be defined by policy, extensions, or pre-populated data. 104 // engine will be defined by policy, extensions, or pre-populated data.
113 void ClearUserSelectedDefaultSearchEngine(); 105 void ClearUserSelectedDefaultSearchEngine();
114 106
115 private: 107 private:
116 // Handles changes to kDefaultSearchProviderData pref. This includes sync and 108 // Handles changes to kDefaultSearchProviderData pref. This includes sync and
117 // policy changes. Calls LoadDefaultSearchEngineFromPrefs() and 109 // policy changes. Calls LoadDefaultSearchEngineFromPrefs() and
118 // NotifyObserver() if the effective DSE might have changed. 110 // NotifyObserver() if the effective DSE might have changed.
119 void OnDefaultSearchPrefChanged(); 111 void OnDefaultSearchPrefChanged();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 // prefs). This will be null if no value was set in the pref store. 150 // prefs). This will be null if no value was set in the pref store.
159 std::unique_ptr<TemplateURLData> prefs_default_search_; 151 std::unique_ptr<TemplateURLData> prefs_default_search_;
160 152
161 // True if the default search is currently enforced by policy. 153 // True if the default search is currently enforced by policy.
162 bool default_search_controlled_by_policy_; 154 bool default_search_controlled_by_policy_;
163 155
164 DISALLOW_COPY_AND_ASSIGN(DefaultSearchManager); 156 DISALLOW_COPY_AND_ASSIGN(DefaultSearchManager);
165 }; 157 };
166 158
167 #endif // COMPONENTS_SEARCH_ENGINES_DEFAULT_SEARCH_MANAGER_H_ 159 #endif // COMPONENTS_SEARCH_ENGINES_DEFAULT_SEARCH_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698