| 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. If the given locale is the same as the existing locale, return |
| 49 // an empty vector. |
| 50 std::vector<std::unique_ptr<TemplateURLData>> GetLocalPrepopulatedEngines( |
| 51 const std::string& locale, |
| 52 PrefService* prefs); |
| 53 #endif |
| 54 |
| 45 // Returns all prepopulated engines for all locales. Used only by tests. | 55 // Returns all prepopulated engines for all locales. Used only by tests. |
| 46 std::vector<const PrepopulatedEngine*> GetAllPrepopulatedEngines(); | 56 std::vector<const PrepopulatedEngine*> GetAllPrepopulatedEngines(); |
| 47 | 57 |
| 48 // Returns a TemplateURLData for the specified prepopulated engine. | 58 // Returns a TemplateURLData for the specified prepopulated engine. |
| 49 std::unique_ptr<TemplateURLData> MakeTemplateURLDataFromPrepopulatedEngine( | 59 std::unique_ptr<TemplateURLData> MakeTemplateURLDataFromPrepopulatedEngine( |
| 50 const PrepopulatedEngine& engine); | 60 const PrepopulatedEngine& engine); |
| 51 | 61 |
| 52 // Removes prepopulated engines and their version stored in user prefs. | 62 // Removes prepopulated engines and their version stored in user prefs. |
| 53 void ClearPrepopulatedEnginesInPrefs(PrefService* prefs); | 63 void ClearPrepopulatedEnginesInPrefs(PrefService* prefs); |
| 54 | 64 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 67 // of search engines when user switches device region settings. For use on iOS | 77 // of search engines when user switches device region settings. For use on iOS |
| 68 // only. | 78 // only. |
| 69 // TODO(ios): Once user can customize search engines ( http://crbug.com/153047 ) | 79 // 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 | 80 // this declaration should be removed and the definition in the .cc file be |
| 71 // moved back to the anonymous namespace. | 81 // moved back to the anonymous namespace. |
| 72 int GetCurrentCountryID(); | 82 int GetCurrentCountryID(); |
| 73 | 83 |
| 74 } // namespace TemplateURLPrepopulateData | 84 } // namespace TemplateURLPrepopulateData |
| 75 | 85 |
| 76 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_PREPOPULATE_DATA_H_ | 86 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_PREPOPULATE_DATA_H_ |
| OLD | NEW |