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

Unified Diff: chrome/browser/search_engines/template_url.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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/search_engines/template_url.h
===================================================================
--- chrome/browser/search_engines/template_url.h (revision 132909)
+++ chrome/browser/search_engines/template_url.h (working copy)
@@ -27,7 +27,8 @@
// callers can substitute values to get a "real" URL using ReplaceSearchTerms().
//
// TemplateURLRefs always have a non-NULL |owner_| TemplateURL, which they
-// access in order to get at important data like the underlying URL string.
+// access in order to get at important data like the underlying URL string or
+// the associated Profile.
class TemplateURLRef {
public:
// Magic numbers to pass to ReplaceSearchTerms() for the |accepted_suggestion|
@@ -70,15 +71,6 @@
int accepted_suggestion,
const string16& original_query_for_suggestion) const;
- // Just like ReplaceSearchTerms except that it takes a Profile that's used to
- // retrieve Instant field trial params. Most callers don't care about those
- // params, and so can use ReplaceSearchTerms instead.
- std::string ReplaceSearchTermsUsingProfile(
- Profile* profile,
- const string16& terms,
- int accepted_suggestion,
- const string16& original_query_for_suggestion) const;
-
// Just like ReplaceSearchTerms except that it takes SearchTermsData to supply
// the data for some search terms. Most of the time ReplaceSearchTerms should
// be called.
@@ -364,7 +356,9 @@
// is made a friend so that it can be the exception to this pattern.
class TemplateURL {
public:
- explicit TemplateURL(const TemplateURLData& data);
+ // |profile| may be NULL. This will affect the results of e.g. calling
+ // ReplaceSearchTerms() on the member TemplateURLRefs.
+ TemplateURL(Profile* profile, const TemplateURLData& data);
TemplateURL(const TemplateURL& other);
TemplateURL& operator=(const TemplateURL& other);
@@ -374,6 +368,7 @@
// Generates a favicon URL from the specified url.
static GURL GenerateFaviconURL(const GURL& url);
+ Profile* profile() { return profile_; }
const TemplateURLData& data() const { return data_; }
const string16& short_name() const { return data_.short_name; }
@@ -443,6 +438,7 @@
// Invalidates cached values on this object and its child TemplateURLRefs.
void InvalidateCachedValues();
+ Profile* profile_;
TemplateURLData data_;
TemplateURLRef url_ref_;
TemplateURLRef suggestions_url_ref_;

Powered by Google App Engine
This is Rietveld 408576698