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

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

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.cc
===================================================================
--- chrome/browser/search_engines/template_url.cc (revision 132909)
+++ chrome/browser/search_engines/template_url.cc (working copy)
@@ -121,17 +121,8 @@
const string16& terms,
int accepted_suggestion,
const string16& original_query_for_suggestion) const {
- return ReplaceSearchTermsUsingProfile(NULL, terms, accepted_suggestion,
- original_query_for_suggestion);
-}
-
-std::string TemplateURLRef::ReplaceSearchTermsUsingProfile(
- Profile* profile,
- const string16& terms,
- int accepted_suggestion,
- const string16& original_query_for_suggestion) const {
UIThreadSearchTermsData search_terms_data;
- search_terms_data.set_profile(profile);
+ search_terms_data.set_profile(owner_->profile());
return ReplaceSearchTermsUsingTermsData(terms, accepted_suggestion,
original_query_for_suggestion, search_terms_data);
}
@@ -623,8 +614,9 @@
// TemplateURL ----------------------------------------------------------------
-TemplateURL::TemplateURL(const TemplateURLData& data)
- : data_(data),
+TemplateURL::TemplateURL(Profile* profile, const TemplateURLData& data)
+ : profile_(profile),
+ data_(data),
url_ref_(ALLOW_THIS_IN_INITIALIZER_LIST(this), TemplateURLRef::SEARCH),
suggestions_url_ref_(ALLOW_THIS_IN_INITIALIZER_LIST(this),
TemplateURLRef::SUGGEST),
@@ -634,7 +626,8 @@
}
TemplateURL::TemplateURL(const TemplateURL& other)
- : data_(other.data_),
+ : profile_(other.profile_),
+ data_(other.data_),
url_ref_(ALLOW_THIS_IN_INITIALIZER_LIST(this), TemplateURLRef::SEARCH),
suggestions_url_ref_(ALLOW_THIS_IN_INITIALIZER_LIST(this),
TemplateURLRef::SUGGEST),
@@ -647,6 +640,7 @@
if (this == &other)
return *this;
+ profile_ = other.profile_;
data_ = other.data_;
url_ref_.InvalidateCachedValues();
suggestions_url_ref_.InvalidateCachedValues();

Powered by Google App Engine
This is Rietveld 408576698