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

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

Issue 338363004: Remove Profile* from TemplateURL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 6 years, 6 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_SERVICE_H_ 5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_
6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ 6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 // This is guaranteed not to return an empty string, since TemplateURLs should 117 // This is guaranteed not to return an empty string, since TemplateURLs should
118 // never have an empty keyword. 118 // never have an empty keyword.
119 static base::string16 GenerateKeyword(const GURL& url); 119 static base::string16 GenerateKeyword(const GURL& url);
120 120
121 // Removes any unnecessary characters from a user input keyword. 121 // Removes any unnecessary characters from a user input keyword.
122 // This removes the leading scheme, "www." and any trailing slash. 122 // This removes the leading scheme, "www." and any trailing slash.
123 static base::string16 CleanUserInputKeyword(const base::string16& keyword); 123 static base::string16 CleanUserInputKeyword(const base::string16& keyword);
124 124
125 // Returns the search url for t_url. Returns an empty GURL if t_url has no 125 // Returns the search url for t_url. Returns an empty GURL if t_url has no
126 // url(). 126 // url().
127 // NOTE: |t_url| is non-const in this version because of the need to access 127 static GURL GenerateSearchURL(const TemplateURL* t_url,
128 // t_url->profile(). 128 const SearchTermsData& search_terms_data);
129 static GURL GenerateSearchURL(TemplateURL* t_url);
130
131 // Just like GenerateSearchURL except that it takes SearchTermsData to supply
132 // the data for some search terms, e.g. so this can be used on threads other
133 // than the UI thread. See the various TemplateURLRef::XXXUsingTermsData()
134 // functions.
135 static GURL GenerateSearchURLUsingTermsData(
136 const TemplateURL* t_url,
137 const SearchTermsData& search_terms_data);
138 129
139 // Saves enough of url to |prefs| so that it can be loaded from preferences on 130 // Saves enough of url to |prefs| so that it can be loaded from preferences on
140 // start up. 131 // start up.
141 static void SaveDefaultSearchProviderToPrefs(const TemplateURL* url, 132 static void SaveDefaultSearchProviderToPrefs(const TemplateURL* url,
142 PrefService* prefs); 133 PrefService* prefs);
143 134
144 // Returns true if there is no TemplateURL that conflicts with the 135 // Returns true if there is no TemplateURL that conflicts with the
145 // keyword/url pair, or there is one but it can be replaced. If there is an 136 // keyword/url pair, or there is one but it can be replaced. If there is an
146 // existing keyword that can be replaced and template_url_to_replace is 137 // existing keyword that can be replaced and template_url_to_replace is
147 // non-NULL, template_url_to_replace is set to the keyword to replace. 138 // non-NULL, template_url_to_replace is set to the keyword to replace.
(...skipping 26 matching lines...) Expand all
174 // or NULL if there are no such TemplateURLs 165 // or NULL if there are no such TemplateURLs
175 TemplateURL* GetTemplateURLForHost(const std::string& host); 166 TemplateURL* GetTemplateURLForHost(const std::string& host);
176 167
177 // Takes ownership of |template_url| and adds it to this model. For obvious 168 // Takes ownership of |template_url| and adds it to this model. For obvious
178 // reasons, it is illegal to Add() the same |template_url| pointer twice. 169 // reasons, it is illegal to Add() the same |template_url| pointer twice.
179 // Returns true if the Add is successful. 170 // Returns true if the Add is successful.
180 bool Add(TemplateURL* template_url); 171 bool Add(TemplateURL* template_url);
181 172
182 // Like Add(), but overwrites the |template_url|'s values with the provided 173 // Like Add(), but overwrites the |template_url|'s values with the provided
183 // ones. 174 // ones.
184 void AddAndSetProfile(TemplateURL* template_url, Profile* profile);
185 void AddWithOverrides(TemplateURL* template_url, 175 void AddWithOverrides(TemplateURL* template_url,
186 const base::string16& short_name, 176 const base::string16& short_name,
187 const base::string16& keyword, 177 const base::string16& keyword,
188 const std::string& url); 178 const std::string& url);
189 179
190 // Add the search engine of type NORMAL_CONTROLLED_BY_EXTENSION. 180 // Add the search engine of type NORMAL_CONTROLLED_BY_EXTENSION.
191 void AddExtensionControlledTURL(TemplateURL* template_url, 181 void AddExtensionControlledTURL(TemplateURL* template_url,
192 scoped_ptr<AssociatedExtensionInfo> info); 182 scoped_ptr<AssociatedExtensionInfo> info);
193 183
194 // Removes the keyword from the model. This deletes the supplied TemplateURL. 184 // Removes the keyword from the model. This deletes the supplied TemplateURL.
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 785
796 scoped_ptr<GoogleURLTracker::Subscription> google_url_updated_subscription_; 786 scoped_ptr<GoogleURLTracker::Subscription> google_url_updated_subscription_;
797 787
798 // Used to disable the prepopulated search engines in tests. 788 // Used to disable the prepopulated search engines in tests.
799 static bool g_fallback_search_engines_disabled; 789 static bool g_fallback_search_engines_disabled;
800 790
801 DISALLOW_COPY_AND_ASSIGN(TemplateURLService); 791 DISALLOW_COPY_AND_ASSIGN(TemplateURLService);
802 }; 792 };
803 793
804 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ 794 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698