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> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/memory/scoped_vector.h" | |
15 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
16 #include "components/search_engines/search_engine_type.h" | 15 #include "components/search_engines/search_engine_type.h" |
17 | 16 |
18 class GURL; | 17 class GURL; |
19 class PrefService; | 18 class PrefService; |
20 struct TemplateURLData; | 19 struct TemplateURLData; |
21 | 20 |
22 namespace user_prefs { | 21 namespace user_prefs { |
23 class PrefRegistrySyncable; | 22 class PrefRegistrySyncable; |
24 } | 23 } |
25 | 24 |
26 namespace TemplateURLPrepopulateData { | 25 namespace TemplateURLPrepopulateData { |
27 | 26 |
28 struct PrepopulatedEngine; | 27 struct PrepopulatedEngine; |
29 | 28 |
30 extern const int kMaxPrepopulatedEngineID; | 29 extern const int kMaxPrepopulatedEngineID; |
31 | 30 |
32 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 31 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
33 | 32 |
34 // 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 |
35 // 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 |
36 // file then it returns the version specified there. | 35 // file then it returns the version specified there. |
37 int GetDataVersion(PrefService* prefs); | 36 int GetDataVersion(PrefService* prefs); |
38 | 37 |
39 // Loads the set of TemplateURLs from the prepopulate data. On return, | 38 // Loads the set of TemplateURLs from the prepopulate data. On return, |
40 // |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 |
41 // provider. | 40 // provider. |
42 ScopedVector<TemplateURLData> GetPrepopulatedEngines( | 41 std::vector<std::unique_ptr<TemplateURLData>> GetPrepopulatedEngines( |
43 PrefService* prefs, | 42 PrefService* prefs, |
44 size_t* default_search_provider_index); | 43 size_t* default_search_provider_index); |
45 | 44 |
46 // Returns all prepopulated engines for all locales. Used only by tests. | 45 // Returns all prepopulated engines for all locales. Used only by tests. |
47 std::vector<const PrepopulatedEngine*> GetAllPrepopulatedEngines(); | 46 std::vector<const PrepopulatedEngine*> GetAllPrepopulatedEngines(); |
48 | 47 |
49 // Returns a TemplateURLData for the specified prepopulated engine. | 48 // Returns a TemplateURLData for the specified prepopulated engine. |
50 std::unique_ptr<TemplateURLData> MakeTemplateURLDataFromPrepopulatedEngine( | 49 std::unique_ptr<TemplateURLData> MakeTemplateURLDataFromPrepopulatedEngine( |
51 const PrepopulatedEngine& engine); | 50 const PrepopulatedEngine& engine); |
52 | 51 |
(...skipping 15 matching lines...) Expand all Loading... |
68 // of search engines when user switches device region settings. For use on iOS | 67 // of search engines when user switches device region settings. For use on iOS |
69 // only. | 68 // only. |
70 // TODO(ios): Once user can customize search engines ( http://crbug.com/153047 ) | 69 // TODO(ios): Once user can customize search engines ( http://crbug.com/153047 ) |
71 // this declaration should be removed and the definition in the .cc file be | 70 // this declaration should be removed and the definition in the .cc file be |
72 // moved back to the anonymous namespace. | 71 // moved back to the anonymous namespace. |
73 int GetCurrentCountryID(); | 72 int GetCurrentCountryID(); |
74 | 73 |
75 } // namespace TemplateURLPrepopulateData | 74 } // namespace TemplateURLPrepopulateData |
76 | 75 |
77 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_PREPOPULATE_DATA_H_ | 76 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_PREPOPULATE_DATA_H_ |
OLD | NEW |