template_url_prepopulate_data.h revision c407dc5cd9bdc5668497f21b26b09d988ab439de
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 3// found in the LICENSE file. 4 5#ifndef CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_PREPOPULATE_DATA_H_ 6#define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_PREPOPULATE_DATA_H_ 7 8#include <vector> 9 10class PrefService; 11class TemplateURL; 12 13namespace TemplateURLPrepopulateData { 14 15// Enum to record the user's default search engine choice in UMA: 16enum SearchEngineType { 17 SEARCH_ENGINE_OTHER = 0, // At the top in case of future list changes. 18 SEARCH_ENGINE_GOOGLE, 19 SEARCH_ENGINE_YAHOO, 20 SEARCH_ENGINE_YAHOOJP, 21 SEARCH_ENGINE_BING, 22 SEARCH_ENGINE_ASK, 23 SEARCH_ENGINE_YANDEX, 24 SEARCH_ENGINE_SEZNAM, 25 SEARCH_ENGINE_CENTRUM, 26 SEARCH_ENGINE_NETSPRINT, 27 SEARCH_ENGINE_VIRGILIO, 28 SEARCH_ENGINE_MAILRU, 29 SEARCH_ENGINE_MAX // Bounding max value needed for UMA histogram macro. 30}; 31 32void RegisterUserPrefs(PrefService* prefs); 33 34// 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 36// file then it returns the version specified there. 37int GetDataVersion(PrefService* prefs); 38 39// Loads the set of TemplateURLs from the prepopulate data. Ownership of the 40// TemplateURLs is passed to the caller. On return, 41// |default_search_provider_index| is set to the index of the default search 42// provider. 43void GetPrepopulatedEngines(PrefService* prefs, 44 std::vector<TemplateURL*>* t_urls, 45 size_t* default_search_provider_index); 46 47// Returns the type of the search engine to be recorded in UMA. The type 48// is determined by mapping the search engine's |id| to the set of search 49// engines we are interested in. Because this is only a temporary test 50// for a small set of search engines, we use this simple switch statement 51// instead of embedding a UMA type as part of the struct of every search 52// engine. 53SearchEngineType GetSearchEngineType(const TemplateURL* search_engine); 54 55} // namespace TemplateURLPrepopulateData 56 57#endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_PREPOPULATE_DATA_H_ 58