| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 class PrefService; | 11 class PrefService; |
| 12 class TemplateURL; | 12 class TemplateURL; |
| 13 | 13 |
| 14 namespace TemplateURLPrepopulateData { | 14 namespace TemplateURLPrepopulateData { |
| 15 | 15 |
| 16 // Enum to record the user's default search engine choice in UMA: | 16 // Enum to record the user's default search engine choice in UMA: |
| 17 enum SearchEngineType { | 17 enum SearchEngineType { |
| 18 SEARCH_ENGINE_OTHER = 0, // At the top in case of future list changes. | 18 SEARCH_ENGINE_OTHER = 0, // At the top in case of future list changes. |
| 19 SEARCH_ENGINE_GOOGLE, | 19 SEARCH_ENGINE_GOOGLE, |
| 20 SEARCH_ENGINE_YAHOO, | 20 SEARCH_ENGINE_YAHOO, |
| 21 SEARCH_ENGINE_YAHOOJP, | 21 SEARCH_ENGINE_YAHOOJP, |
| 22 SEARCH_ENGINE_BING, | 22 SEARCH_ENGINE_BING, |
| 23 SEARCH_ENGINE_ASK, | 23 SEARCH_ENGINE_ASK, |
| 24 SEARCH_ENGINE_YANDEX, | 24 SEARCH_ENGINE_YANDEX, |
| 25 SEARCH_ENGINE_SEZNAM, | 25 SEARCH_ENGINE_SEZNAM, |
| 26 SEARCH_ENGINE_CENTRUM, | 26 SEARCH_ENGINE_CENTRUM, |
| 27 SEARCH_ENGINE_NETSPRINT, | 27 SEARCH_ENGINE_NETSPRINT, |
| 28 SEARCH_ENGINE_VIRGILIO, | 28 SEARCH_ENGINE_VIRGILIO, |
| 29 SEARCH_ENGINE_MAILRU, | 29 SEARCH_ENGINE_MAILRU, |
| 30 SEARCH_ENGINE_ABCSOK, |
| 31 SEARCH_ENGINE_ALTAVISTA, |
| 32 SEARCH_ENGINE_BAIDU, |
| 33 SEARCH_ENGINE_DAUM, |
| 34 SEARCH_ENGINE_DELFI, |
| 35 SEARCH_ENGINE_DIRI, |
| 36 SEARCH_ENGINE_GOO, |
| 37 SEARCH_ENGINE_IN, |
| 38 SEARCH_ENGINE_NAJDI, |
| 39 SEARCH_ENGINE_NAVER, |
| 40 SEARCH_ENGINE_NETI, |
| 41 SEARCH_ENGINE_OK, |
| 42 SEARCH_ENGINE_POGODAK, |
| 43 SEARCH_ENGINE_POGODOK_MK, |
| 44 SEARCH_ENGINE_RAMBLER, |
| 45 SEARCH_ENGINE_SANOOK, |
| 46 SEARCH_ENGINE_SAPO, |
| 47 SEARCH_ENGINE_TUT, |
| 48 SEARCH_ENGINE_WALLA, |
| 49 SEARCH_ENGINE_ZOZNAM, |
| 30 SEARCH_ENGINE_MAX // Bounding max value needed for UMA histogram macro. | 50 SEARCH_ENGINE_MAX // Bounding max value needed for UMA histogram macro. |
| 31 }; | 51 }; |
| 32 | 52 |
| 33 void RegisterUserPrefs(PrefService* prefs); | 53 void RegisterUserPrefs(PrefService* prefs); |
| 34 | 54 |
| 35 // Returns the current version of the prepopulate data, so callers can know when | 55 // Returns the current version of the prepopulate data, so callers can know when |
| 36 // they need to re-merge. If the prepopulate data comes from the preferences | 56 // they need to re-merge. If the prepopulate data comes from the preferences |
| 37 // file then it returns the version specified there. | 57 // file then it returns the version specified there. |
| 38 int GetDataVersion(PrefService* prefs); | 58 int GetDataVersion(PrefService* prefs); |
| 39 | 59 |
| 40 // Loads the set of TemplateURLs from the prepopulate data. Ownership of the | 60 // Loads the set of TemplateURLs from the prepopulate data. Ownership of the |
| 41 // TemplateURLs is passed to the caller. On return, | 61 // TemplateURLs is passed to the caller. On return, |
| 42 // |default_search_provider_index| is set to the index of the default search | 62 // |default_search_provider_index| is set to the index of the default search |
| 43 // provider. | 63 // provider. |
| 44 void GetPrepopulatedEngines(PrefService* prefs, | 64 void GetPrepopulatedEngines(PrefService* prefs, |
| 45 std::vector<TemplateURL*>* t_urls, | 65 std::vector<TemplateURL*>* t_urls, |
| 46 size_t* default_search_provider_index); | 66 size_t* default_search_provider_index); |
| 47 | 67 |
| 48 // Returns the type of the search engine to be recorded in UMA. The type | |
| 49 // is determined by mapping the search engine's |id| to the set of search | |
| 50 // engines we are interested in. Because this is only a temporary test | |
| 51 // for a small set of search engines, we use this simple switch statement | |
| 52 // instead of embedding a UMA type as part of the struct of every search | |
| 53 // engine. | |
| 54 SearchEngineType GetSearchEngineType(const TemplateURL* search_engine); | |
| 55 | |
| 56 } // namespace TemplateURLPrepopulateData | 68 } // namespace TemplateURLPrepopulateData |
| 57 | 69 |
| 58 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_PREPOPULATE_DATA_H_ | 70 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_PREPOPULATE_DATA_H_ |
| OLD | NEW |