| 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" | 14 #include "base/memory/scoped_vector.h" |
| 15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
| 16 #include "components/search_engines/search_engine_type.h" | 16 #include "components/search_engines/search_engine_type.h" |
| 17 | 17 |
| 18 class GURL; | 18 class GURL; |
| 19 class PrefService; | 19 class PrefService; |
| 20 class SearchTermsData; | |
| 21 class TemplateURL; | |
| 22 struct TemplateURLData; | 20 struct TemplateURLData; |
| 23 | 21 |
| 24 namespace user_prefs { | 22 namespace user_prefs { |
| 25 class PrefRegistrySyncable; | 23 class PrefRegistrySyncable; |
| 26 } | 24 } |
| 27 | 25 |
| 28 namespace TemplateURLPrepopulateData { | 26 namespace TemplateURLPrepopulateData { |
| 29 | 27 |
| 30 struct PrepopulatedEngine; | 28 struct PrepopulatedEngine; |
| 31 | 29 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 52 // Removes prepopulated engines and their version stored in user prefs. | 50 // Removes prepopulated engines and their version stored in user prefs. |
| 53 void ClearPrepopulatedEnginesInPrefs(PrefService* prefs); | 51 void ClearPrepopulatedEnginesInPrefs(PrefService* prefs); |
| 54 | 52 |
| 55 // Returns the default search provider specified by the prepopulate data, which | 53 // Returns the default search provider specified by the prepopulate data, which |
| 56 // may be NULL. | 54 // may be NULL. |
| 57 // If |prefs| is NULL, any search provider overrides from the preferences are | 55 // If |prefs| is NULL, any search provider overrides from the preferences are |
| 58 // not used. | 56 // not used. |
| 59 std::unique_ptr<TemplateURLData> GetPrepopulatedDefaultSearch( | 57 std::unique_ptr<TemplateURLData> GetPrepopulatedDefaultSearch( |
| 60 PrefService* prefs); | 58 PrefService* prefs); |
| 61 | 59 |
| 62 // Returns the type of the provided engine, or SEARCH_ENGINE_OTHER if no engines | |
| 63 // match. This checks the TLD+1 for the most part, but will report the type as | |
| 64 // SEARCH_ENGINE_GOOGLE for any hostname that causes | |
| 65 // google_util::IsGoogleHostname() to return true. | |
| 66 // | |
| 67 // NOTE: Must be called on the UI thread. | |
| 68 SearchEngineType GetEngineType(const TemplateURL& template_url, | |
| 69 const SearchTermsData& search_terms_data); | |
| 70 | |
| 71 // Like the above, but takes a GURL which is expected to represent a search URL. | 60 // Like the above, but takes a GURL which is expected to represent a search URL. |
| 72 // This may be called on any thread. | 61 // This may be called on any thread. |
| 73 SearchEngineType GetEngineType(const GURL& url); | 62 SearchEngineType GetEngineType(const GURL& url); |
| 74 | 63 |
| 75 // Returns the identifier for the user current country. Used to update the list | 64 // Returns the identifier for the user current country. Used to update the list |
| 76 // of search engines when user switches device region settings. For use on iOS | 65 // of search engines when user switches device region settings. For use on iOS |
| 77 // only. | 66 // only. |
| 78 // TODO(ios): Once user can customize search engines ( http://crbug.com/153047 ) | 67 // TODO(ios): Once user can customize search engines ( http://crbug.com/153047 ) |
| 79 // this declaration should be removed and the definition in the .cc file be | 68 // this declaration should be removed and the definition in the .cc file be |
| 80 // moved back to the anonymous namespace. | 69 // moved back to the anonymous namespace. |
| 81 int GetCurrentCountryID(); | 70 int GetCurrentCountryID(); |
| 82 | 71 |
| 83 } // namespace TemplateURLPrepopulateData | 72 } // namespace TemplateURLPrepopulateData |
| 84 | 73 |
| 85 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_PREPOPULATE_DATA_H_ | 74 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_PREPOPULATE_DATA_H_ |
| OLD | NEW |