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_TEMPLATE_URL_PREPOPULATE_DATA_H_ | 5 #ifndef COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_PREPOPULATE_DATA_H_ |
6 #define COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_PREPOPULATE_DATA_H_ | 6 #define COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_PREPOPULATE_DATA_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 17 matching lines...) Expand all Loading... | |
28 | 28 |
29 extern const int kMaxPrepopulatedEngineID; | 29 extern const int kMaxPrepopulatedEngineID; |
30 | 30 |
31 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 31 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
32 | 32 |
33 // Returns the current version of the prepopulate data, so callers can know when | 33 // Returns the current version of the prepopulate data, so callers can know when |
34 // they need to re-merge. If the prepopulate data comes from the preferences | 34 // they need to re-merge. If the prepopulate data comes from the preferences |
35 // file then it returns the version specified there. | 35 // file then it returns the version specified there. |
36 int GetDataVersion(PrefService* prefs); | 36 int GetDataVersion(PrefService* prefs); |
37 | 37 |
38 // Loads the set of TemplateURLs from the prepopulate data. On return, | 38 // Returns the prepopulated URLs for the current country. |
39 // |default_search_provider_index| is set to the index of the default search | 39 // |default_search_provider_index| is set to the index of the default search |
40 // provider. | 40 // provider within the returned vector. |
41 std::vector<std::unique_ptr<TemplateURLData>> GetPrepopulatedEngines( | 41 std::vector<std::unique_ptr<TemplateURLData>> GetPrepopulatedEngines( |
42 PrefService* prefs, | 42 PrefService* prefs, |
43 size_t* default_search_provider_index); | 43 size_t* default_search_provider_index); |
44 | 44 |
45 #if defined(OS_ANDROID) | |
46 // Returns the prepopulated URLs associated with |locale|, if it differs from | |
47 // the current country. |locale| should be a two-character uppercase ISO 3166-1 | |
48 // country code. | |
49 std::vector<std::unique_ptr<TemplateURLData>> GetLocalPrepopulatedEngines( | |
Peter Kasting
2016/09/21 21:45:08
Nit: The only thing I worry about with this functi
Ian Wen
2016/09/21 23:12:38
I added a clarification to make it more clear that
| |
50 const std::string& locale, | |
51 PrefService* prefs); | |
52 #endif | |
53 | |
45 // Returns all prepopulated engines for all locales. Used only by tests. | 54 // Returns all prepopulated engines for all locales. Used only by tests. |
46 std::vector<const PrepopulatedEngine*> GetAllPrepopulatedEngines(); | 55 std::vector<const PrepopulatedEngine*> GetAllPrepopulatedEngines(); |
47 | 56 |
48 // Returns a TemplateURLData for the specified prepopulated engine. | 57 // Returns a TemplateURLData for the specified prepopulated engine. |
49 std::unique_ptr<TemplateURLData> MakeTemplateURLDataFromPrepopulatedEngine( | 58 std::unique_ptr<TemplateURLData> MakeTemplateURLDataFromPrepopulatedEngine( |
50 const PrepopulatedEngine& engine); | 59 const PrepopulatedEngine& engine); |
51 | 60 |
52 // Removes prepopulated engines and their version stored in user prefs. | 61 // Removes prepopulated engines and their version stored in user prefs. |
53 void ClearPrepopulatedEnginesInPrefs(PrefService* prefs); | 62 void ClearPrepopulatedEnginesInPrefs(PrefService* prefs); |
54 | 63 |
(...skipping 12 matching lines...) Expand all Loading... | |
67 // of search engines when user switches device region settings. For use on iOS | 76 // of search engines when user switches device region settings. For use on iOS |
68 // only. | 77 // only. |
69 // TODO(ios): Once user can customize search engines ( http://crbug.com/153047 ) | 78 // TODO(ios): Once user can customize search engines ( http://crbug.com/153047 ) |
70 // this declaration should be removed and the definition in the .cc file be | 79 // this declaration should be removed and the definition in the .cc file be |
71 // moved back to the anonymous namespace. | 80 // moved back to the anonymous namespace. |
72 int GetCurrentCountryID(); | 81 int GetCurrentCountryID(); |
73 | 82 |
74 } // namespace TemplateURLPrepopulateData | 83 } // namespace TemplateURLPrepopulateData |
75 | 84 |
76 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_PREPOPULATE_DATA_H_ | 85 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_PREPOPULATE_DATA_H_ |
OLD | NEW |