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

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

Issue 10173001: Add a Profile* member to TemplateURL. This makes some invocations of ReplaceSearchTerms() a bit le… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 8 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
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>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/string16.h" 13 #include "base/string16.h"
14 #include "chrome/browser/search_engines/search_engine_type.h" 14 #include "chrome/browser/search_engines/search_engine_type.h"
15 15
16 class GURL; 16 class GURL;
17 class PrefService; 17 class PrefService;
18 class Profile;
18 class TemplateURL; 19 class TemplateURL;
19 20
20 namespace TemplateURLPrepopulateData { 21 namespace TemplateURLPrepopulateData {
21 22
22 extern const int kMaxPrepopulatedEngineID; 23 extern const int kMaxPrepopulatedEngineID;
23 24
24 void RegisterUserPrefs(PrefService* prefs); 25 void RegisterUserPrefs(PrefService* prefs);
25 26
26 // Returns the current version of the prepopulate data, so callers can know when 27 // Returns the current version of the prepopulate data, so callers can know when
27 // they need to re-merge. If the prepopulate data comes from the preferences 28 // they need to re-merge. If the prepopulate data comes from the preferences
28 // file then it returns the version specified there. 29 // file then it returns the version specified there.
29 int GetDataVersion(PrefService* prefs); 30 int GetDataVersion(PrefService* prefs);
30 31
31 // Loads the set of TemplateURLs from the prepopulate data. Ownership of the 32 // Loads the set of TemplateURLs from the prepopulate data. Ownership of the
32 // TemplateURLs is passed to the caller. On return, 33 // TemplateURLs is passed to the caller. On return,
33 // |default_search_provider_index| is set to the index of the default search 34 // |default_search_provider_index| is set to the index of the default search
34 // provider. 35 // provider.
35 void GetPrepopulatedEngines(PrefService* prefs, 36 void GetPrepopulatedEngines(Profile* profile,
36 std::vector<TemplateURL*>* t_urls, 37 std::vector<TemplateURL*>* t_urls,
37 size_t* default_search_provider_index); 38 size_t* default_search_provider_index);
38 39
39 // Returns the default search provider specified by the prepopulate data. 40 // Returns the default search provider specified by the prepopulate data.
40 // The caller owns the returned value, which may be NULL. 41 // The caller owns the returned value, which may be NULL.
41 // If |prefs| is NULL, any search provider overrides from the preferences are 42 // If |profile| is NULL, any search provider overrides from the preferences are
42 // not used. 43 // not used.
43 TemplateURL* GetPrepopulatedDefaultSearch(PrefService* prefs); 44 TemplateURL* GetPrepopulatedDefaultSearch(Profile* profile);
44 45
45 // Both the next two functions use same-origin checks unless the |url| is a 46 // Both the next two functions use same-origin checks unless the |url| is a
46 // Google seach URL, in which case we'll identify any valid Google hostname, or 47 // Google seach URL, in which case we'll identify any valid Google hostname, or
47 // the unsubstituted Google prepopulate URL, as "Google". 48 // the unsubstituted Google prepopulate URL, as "Google".
48 49
49 // Returns the short name for the matching engine, or url.host() if no engines 50 // Returns the short name for the matching engine, or url.host() if no engines
50 // match. If no engines match and the |url| can't be converted to a valid GURL, 51 // match. If no engines match and the |url| can't be converted to a valid GURL,
51 // returns the string in IDS_UNKNOWN_SEARCH_ENGINE_NAME. 52 // returns the string in IDS_UNKNOWN_SEARCH_ENGINE_NAME.
52 string16 GetEngineName(const std::string& url); 53 string16 GetEngineName(const std::string& url);
53 54
54 // Returns the type of the matching engine, or SEARCH_ENGINE_OTHER if no engines 55 // Returns the type of the matching engine, or SEARCH_ENGINE_OTHER if no engines
55 // match. 56 // match.
56 SearchEngineType GetEngineType(const std::string& url); 57 SearchEngineType GetEngineType(const std::string& url);
57 58
58 } // namespace TemplateURLPrepopulateData 59 } // namespace TemplateURLPrepopulateData
59 60
60 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_PREPOPULATE_DATA_H_ 61 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_PREPOPULATE_DATA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698