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/macros.h" | 8 #include "base/macros.h" |
9 | 9 |
| 10 namespace base { |
| 11 class DictionaryValue; |
| 12 } |
| 13 |
10 namespace user_prefs { | 14 namespace user_prefs { |
11 class PrefRegistrySyncable; | 15 class PrefRegistrySyncable; |
12 } | 16 } |
13 | 17 |
14 class PrefService; | 18 class PrefService; |
| 19 class PrefValueMap; |
15 struct TemplateURLData; | 20 struct TemplateURLData; |
16 | 21 |
17 // DefaultSearchManager handles the loading and writing of the user's default | 22 // DefaultSearchManager handles the loading and writing of the user's default |
18 // search engine selection to and from prefs. | 23 // search engine selection to and from prefs. |
19 | 24 |
20 class DefaultSearchManager { | 25 class DefaultSearchManager { |
21 public: | 26 public: |
22 static const char kID[]; | 27 static const char kID[]; |
23 static const char kShortName[]; | 28 static const char kShortName[]; |
24 static const char kKeyword[]; | 29 static const char kKeyword[]; |
(...skipping 16 matching lines...) Expand all Loading... |
41 static const char kSafeForAutoReplace[]; | 46 static const char kSafeForAutoReplace[]; |
42 static const char kInputEncodings[]; | 47 static const char kInputEncodings[]; |
43 | 48 |
44 static const char kDateCreated[]; | 49 static const char kDateCreated[]; |
45 static const char kLastModified[]; | 50 static const char kLastModified[]; |
46 | 51 |
47 static const char kUsageCount[]; | 52 static const char kUsageCount[]; |
48 static const char kAlternateURLs[]; | 53 static const char kAlternateURLs[]; |
49 static const char kSearchTermsReplacementKey[]; | 54 static const char kSearchTermsReplacementKey[]; |
50 static const char kCreatedByPolicy[]; | 55 static const char kCreatedByPolicy[]; |
| 56 static const char kDisabledByPolicy[]; |
51 | 57 |
52 explicit DefaultSearchManager(PrefService* pref_service); | 58 explicit DefaultSearchManager(PrefService* pref_service); |
53 ~DefaultSearchManager(); | 59 ~DefaultSearchManager(); |
54 | 60 |
55 // Register prefs needed for tracking the default search provider. | 61 // Register prefs needed for tracking the default search provider. |
56 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 62 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
57 | 63 |
| 64 // Save default search provider pref values into the map provided. |
| 65 static void AddPrefValueToMap(base::DictionaryValue* value, |
| 66 PrefValueMap* pref_value_map); |
| 67 |
58 // Read default search provider data from |pref_service_|. | 68 // Read default search provider data from |pref_service_|. |
59 bool GetDefaultSearchEngine(TemplateURLData* url); | 69 bool GetDefaultSearchEngine(TemplateURLData* url); |
60 | 70 |
61 // Write default search provider data to |pref_service_|. | 71 // Write default search provider data to |pref_service_|. |
62 void SetUserSelectedDefaultSearchEngine(const TemplateURLData& data); | 72 void SetUserSelectedDefaultSearchEngine(const TemplateURLData& data); |
63 | 73 |
64 // Clear the user's default search provider choice from |pref_service_|. | 74 // Clear the user's default search provider choice from |pref_service_|. |
65 void ClearUserSelectedDefaultSearchEngine(); | 75 void ClearUserSelectedDefaultSearchEngine(); |
66 | 76 |
67 private: | 77 private: |
68 PrefService* pref_service_; | 78 PrefService* pref_service_; |
69 | 79 |
70 DISALLOW_COPY_AND_ASSIGN(DefaultSearchManager); | 80 DISALLOW_COPY_AND_ASSIGN(DefaultSearchManager); |
71 }; | 81 }; |
72 | 82 |
73 #endif // CHROME_BROWSER_SEARCH_ENGINES_DEFAULT_SEARCH_MANAGER_H_ | 83 #endif // CHROME_BROWSER_SEARCH_ENGINES_DEFAULT_SEARCH_MANAGER_H_ |
OLD | NEW |