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 CHROME_BROWSER_SEARCH_ENGINES_DEFAULT_SEARCH_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_DEFAULT_SEARCH_MANAGER_H_ |
6 #define CHROME_BROWSER_SEARCH_ENGINES_DEFAULT_SEARCH_MANAGER_H_ | 6 #define CHROME_BROWSER_SEARCH_ENGINES_DEFAULT_SEARCH_MANAGER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 ~DefaultSearchManager(); | 74 ~DefaultSearchManager(); |
75 | 75 |
76 // Register prefs needed for tracking the default search provider. | 76 // Register prefs needed for tracking the default search provider. |
77 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 77 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
78 | 78 |
79 // Save default search provider pref values into the map provided. | 79 // Save default search provider pref values into the map provided. |
80 static void AddPrefValueToMap(base::DictionaryValue* value, | 80 static void AddPrefValueToMap(base::DictionaryValue* value, |
81 PrefValueMap* pref_value_map); | 81 PrefValueMap* pref_value_map); |
82 | 82 |
| 83 // Testing code can call this with |disabled| set to true to cause |
| 84 // GetDefaultSearchEngine() to return NULL instead of |
| 85 // |fallback_default_search_| in cases where the DSE source is FROM_FALLBACK. |
| 86 static void SetFallbackSearchEnginesDisabledForTesting(bool disabled); |
| 87 |
83 // Gets a pointer to the current Default Search Engine. If NULL, indicates | 88 // Gets a pointer to the current Default Search Engine. If NULL, indicates |
84 // that Default Search is explicitly disabled. |source|, if not NULL, will be | 89 // that Default Search is explicitly disabled. |source|, if not NULL, will be |
85 // filled in with the source of the result. | 90 // filled in with the source of the result. |
86 TemplateURLData* GetDefaultSearchEngine(Source* source) const; | 91 TemplateURLData* GetDefaultSearchEngine(Source* source) const; |
87 | 92 |
88 // Gets the source of the current Default Search Engine value. | 93 // Gets the source of the current Default Search Engine value. |
89 Source GetDefaultSearchEngineSource() const; | 94 Source GetDefaultSearchEngineSource() const; |
90 | 95 |
91 // Write default search provider data to |pref_service_|. | 96 // Write default search provider data to |pref_service_|. |
92 void SetUserSelectedDefaultSearchEngine(const TemplateURLData& data); | 97 void SetUserSelectedDefaultSearchEngine(const TemplateURLData& data); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 // default search engines. | 155 // default search engines. |
151 scoped_ptr<TemplateURLData> prefs_default_search_; | 156 scoped_ptr<TemplateURLData> prefs_default_search_; |
152 | 157 |
153 // True if the default search is currently enforced by policy. | 158 // True if the default search is currently enforced by policy. |
154 bool default_search_controlled_by_policy_; | 159 bool default_search_controlled_by_policy_; |
155 | 160 |
156 DISALLOW_COPY_AND_ASSIGN(DefaultSearchManager); | 161 DISALLOW_COPY_AND_ASSIGN(DefaultSearchManager); |
157 }; | 162 }; |
158 | 163 |
159 #endif // CHROME_BROWSER_SEARCH_ENGINES_DEFAULT_SEARCH_MANAGER_H_ | 164 #endif // CHROME_BROWSER_SEARCH_ENGINES_DEFAULT_SEARCH_MANAGER_H_ |
OLD | NEW |