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

Unified Diff: chrome/browser/search_engines/template_url.h

Issue 343823002: Move GenerateSearchURL() and GenerateKeyword() from TemplateURLService to TemplateURL (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move GenerateKeyword() 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/search_engines/template_url.h
diff --git a/chrome/browser/search_engines/template_url.h b/chrome/browser/search_engines/template_url.h
index ec07d520d1880e7e5610cb25b9e15398b62d6690..b105b5889ba6e915a9fafdb5ef4e9acc09b59a0e 100644
--- a/chrome/browser/search_engines/template_url.h
+++ b/chrome/browser/search_engines/template_url.h
@@ -482,6 +482,11 @@ class TemplateURL {
// Generates a favicon URL from the specified url.
static GURL GenerateFaviconURL(const GURL& url);
+ // Generates a suitable keyword for the specified url, which must be valid.
+ // This is guaranteed not to return an empty string, since TemplateURLs should
+ // never have an empty keyword.
+ static base::string16 GenerateKeyword(const GURL& url);
Peter Kasting 2014/06/19 17:41:59 Tiny nit: Given that the keyword member comes befo
hashimoto 2014/06/19 17:56:05 Makes sense. Done.
+
// Returns true if |t_url| and |data| are equal in all meaningful respects.
// Static to allow either or both params to be NULL.
static bool MatchesData(const TemplateURL* t_url,
@@ -649,6 +654,10 @@ class TemplateURL {
base::string16* encoded_terms,
base::string16* encoded_original_query) const;
+ // Returns the search url for this template URL.
+ // Returns an empty GURL if this template URL has no url().
+ GURL GenerateSearchURL(const SearchTermsData& search_terms_data) const;
+
private:
friend class TemplateURLService;
FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ReflectsBookmarkBarPinned);
@@ -661,8 +670,7 @@ class TemplateURL {
// Resets the keyword if IsGoogleSearchURLWithReplaceableKeyword() or |force|.
// The |force| parameter is useful when the existing keyword is known to be
// a placeholder. The resulting keyword is generated using
- // TemplateURLService::GenerateSearchURL() and
- // TemplateURLService::GenerateKeyword().
+ // GenerateSearchURL() and GenerateKeyword().
void ResetKeywordIfNecessary(const SearchTermsData& search_terms_data,
bool force);
« no previous file with comments | « chrome/browser/search_engines/search_provider_install_data.cc ('k') | chrome/browser/search_engines/template_url.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698