OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_TEMPLATE_URL_PREPOPULATE_DATA_H_ | 5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_PREPOPULATE_DATA_H_ |
6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_PREPOPULATE_DATA_H_ | 6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_PREPOPULATE_DATA_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 class GURL; | 12 class GURL; |
13 class PrefService; | 13 class PrefService; |
| 14 class Profile; |
14 class TemplateURL; | 15 class TemplateURL; |
15 | 16 |
16 namespace TemplateURLPrepopulateData { | 17 namespace TemplateURLPrepopulateData { |
17 | 18 |
18 void RegisterUserPrefs(PrefService* prefs); | 19 void RegisterUserPrefs(PrefService* prefs); |
19 | 20 |
20 // Returns the current version of the prepopulate data, so callers can know when | 21 // Returns the current version of the prepopulate data, so callers can know when |
21 // they need to re-merge. If the prepopulate data comes from the preferences | 22 // they need to re-merge. If the prepopulate data comes from the preferences |
22 // file then it returns the version specified there. | 23 // file then it returns the version specified there. |
23 int GetDataVersion(PrefService* prefs); | 24 int GetDataVersion(PrefService* prefs); |
24 | 25 |
25 // Loads the set of TemplateURLs from the prepopulate data. Ownership of the | 26 // Loads the set of TemplateURLs from the prepopulate data. Ownership of the |
26 // TemplateURLs is passed to the caller. On return, | 27 // TemplateURLs is passed to the caller. On return, |
27 // |default_search_provider_index| is set to the index of the default search | 28 // |default_search_provider_index| is set to the index of the default search |
28 // provider. | 29 // provider. |
29 void GetPrepopulatedEngines(PrefService* prefs, | 30 void GetPrepopulatedEngines(PrefService* prefs, |
30 std::vector<TemplateURL*>* t_urls, | 31 std::vector<TemplateURL*>* t_urls, |
31 size_t* default_search_provider_index); | 32 size_t* default_search_provider_index); |
32 | 33 |
33 // Returns the default search provider specified by the prepopulate data. | 34 // Returns the default search provider specified by the prepopulate data. |
34 // The caller owns the returned value, which may be NULL. | 35 // The caller owns the returned value, which may be NULL. |
35 TemplateURL* GetPrepopulatedDefaultSearch(PrefService* prefs); | 36 TemplateURL* GetPrepopulatedDefaultSearch(PrefService* prefs); |
36 | 37 |
37 // Returns a TemplateURL from the prepopulated data which has the same origin | 38 // Returns a TemplateURL from the prepopulated data which has the same origin |
38 // as the given url. The caller is responsible for deleting the returned | 39 // as the given url. The caller is responsible for deleting the returned |
39 // TemplateURL. | 40 // TemplateURL. |
40 TemplateURL* GetEngineForOrigin(PrefService* prefs, const GURL& url_to_find); | 41 TemplateURL* GetEngineForOrigin(Profile* profile, const GURL& url_to_find); |
41 | 42 |
42 // Returns search engine logo for URLs known to have a search engine logo. | 43 // Returns search engine logo for URLs known to have a search engine logo. |
43 int GetSearchEngineLogo(const GURL& url_to_find); | 44 int GetSearchEngineLogo(const GURL& url_to_find); |
44 | 45 |
45 } // namespace TemplateURLPrepopulateData | 46 } // namespace TemplateURLPrepopulateData |
46 | 47 |
47 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_PREPOPULATE_DATA_H_ | 48 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_PREPOPULATE_DATA_H_ |
OLD | NEW |