OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string> | 10 #include <string> |
(...skipping 25 matching lines...) Expand all Loading... |
36 void GetPrepopulatedEngines(Profile* profile, | 36 void GetPrepopulatedEngines(Profile* profile, |
37 std::vector<TemplateURL*>* t_urls, | 37 std::vector<TemplateURL*>* t_urls, |
38 size_t* default_search_provider_index); | 38 size_t* default_search_provider_index); |
39 | 39 |
40 // Returns the default search provider specified by the prepopulate data. | 40 // Returns the default search provider specified by the prepopulate data. |
41 // The caller owns the returned value, which may be NULL. | 41 // The caller owns the returned value, which may be NULL. |
42 // If |profile| is NULL, any search provider overrides from the preferences are | 42 // If |profile| is NULL, any search provider overrides from the preferences are |
43 // not used. | 43 // not used. |
44 TemplateURL* GetPrepopulatedDefaultSearch(Profile* profile); | 44 TemplateURL* GetPrepopulatedDefaultSearch(Profile* profile); |
45 | 45 |
46 // Both the next two functions use same-origin checks unless the |url| is a | |
47 // Google seach URL, in which case we'll identify any valid Google hostname, or | |
48 // the unsubstituted Google prepopulate URL, as "Google". | |
49 | |
50 // Returns the short name for the matching engine, or url.host() if no engines | |
51 // match. If no engines match and the |url| can't be converted to a valid GURL, | |
52 // returns the string in IDS_UNKNOWN_SEARCH_ENGINE_NAME. | |
53 string16 GetEngineName(const std::string& url); | |
54 | |
55 // Returns the type of the matching engine, or SEARCH_ENGINE_OTHER if no engines | 46 // Returns the type of the matching engine, or SEARCH_ENGINE_OTHER if no engines |
56 // match. | 47 // match. This uses same-origin checks unless the |url| is a Google seach URL, |
| 48 // in which case we'll identify any valid Google hostname as "Google". |
| 49 // |
| 50 // NOTE: Must be called on the UI thread. |
57 SearchEngineType GetEngineType(const std::string& url); | 51 SearchEngineType GetEngineType(const std::string& url); |
58 | 52 |
59 } // namespace TemplateURLPrepopulateData | 53 } // namespace TemplateURLPrepopulateData |
60 | 54 |
61 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_PREPOPULATE_DATA_H_ | 55 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_PREPOPULATE_DATA_H_ |
OLD | NEW |