Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(762)

Side by Side Diff: chrome/browser/search_engines/template_url_prepopulate_data.h

Issue 355853002: Componentize TemplateURLPrepopulateData, DefaultSearchManager and DefaultSearchPolicyHandler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Missing comma in gyp Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
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 <stddef.h>
9 #include <string>
10 #include <vector>
11
12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/scoped_vector.h"
14 #include "base/strings/string16.h"
15 #include "components/search_engines/search_engine_type.h"
16
17 class GURL;
18 class PrefService;
19 class Profile;
20 class SearchTermsData;
21 class TemplateURL;
22 struct TemplateURLData;
23
24 namespace user_prefs {
25 class PrefRegistrySyncable;
26 }
27
28 namespace TemplateURLPrepopulateData {
29
30 extern const int kMaxPrepopulatedEngineID;
31
32 #if defined(OS_ANDROID)
33 // This must be called early only once. |country_code| is the country code at
34 // install following the ISO-3166 specification.
35 void InitCountryCode(const std::string& country_code);
36 #endif
37
38 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
39
40 // Returns the current version of the prepopulate data, so callers can know when
41 // they need to re-merge. If the prepopulate data comes from the preferences
42 // file then it returns the version specified there.
43 int GetDataVersion(PrefService* prefs);
44
45 // Loads the set of TemplateURLs from the prepopulate data. On return,
46 // |default_search_provider_index| is set to the index of the default search
47 // provider.
48 ScopedVector<TemplateURLData> GetPrepopulatedEngines(
49 PrefService* prefs,
50 size_t* default_search_provider_index);
51
52 // Removes prepopulated engines and their version stored in user prefs.
53 void ClearPrepopulatedEnginesInPrefs(PrefService* prefs);
54
55 // Returns the default search provider specified by the prepopulate data, which
56 // may be NULL.
57 // If |prefs| is NULL, any search provider overrides from the preferences are
58 // not used.
59 scoped_ptr<TemplateURLData> GetPrepopulatedDefaultSearch(PrefService* prefs);
60
61 // Returns the type of the provided engine, or SEARCH_ENGINE_OTHER if no engines
62 // match. This checks the TLD+1 for the most part, but will report the type as
63 // SEARCH_ENGINE_GOOGLE for any hostname that causes
64 // google_util::IsGoogleHostname() to return true.
65 //
66 // NOTE: Must be called on the UI thread.
67 SearchEngineType GetEngineType(const TemplateURL& template_url,
68 const SearchTermsData& search_terms_data);
69
70 // Like the above, but takes a GURL which is expected to represent a search URL.
71 // This may be called on any thread.
72 SearchEngineType GetEngineType(const GURL& url);
73
74 } // namespace TemplateURLPrepopulateData
75
76 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_PREPOPULATE_DATA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698