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

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

Issue 7558014: Add a URL param to indicate group selection in Instant field trial. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed @pkasting's comments Created 9 years, 4 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
« no previous file with comments | « chrome/browser/instant/instant_loader.cc ('k') | chrome/browser/search_engines/search_terms_data.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/search_engines/search_terms_data.h
diff --git a/chrome/browser/search_engines/search_terms_data.h b/chrome/browser/search_engines/search_terms_data.h
index a695a113c7eca0c3c50913ef03895142f98e1622..ec108014efa3b6fdf016e76ac513460fd660c874 100644
--- a/chrome/browser/search_engines/search_terms_data.h
+++ b/chrome/browser/search_engines/search_terms_data.h
@@ -11,6 +11,8 @@
#include "base/basictypes.h"
#include "base/string16.h"
+class Profile;
+
// All data needed by TemplateURLRef::ReplaceSearchTerms which typically may
// only be accessed on the UI thread.
class SearchTermsData {
@@ -32,6 +34,13 @@ class SearchTermsData {
virtual string16 GetRlzParameterValue() const = 0;
#endif
+ // Returns a string indicating the Instant field trial group, suitable for
+ // adding as a query string param to suggest/search URLs, or an empty string
+ // if the field trial is not active. Checking the field trial group requires
+ // accessing the Profile, which means this can only ever be non-empty for
+ // UIThreadSearchTermsData.
+ virtual std::string InstantFieldTrialUrlParam() const;
+
private:
DISALLOW_COPY_AND_ASSIGN(SearchTermsData);
};
@@ -41,6 +50,10 @@ class UIThreadSearchTermsData : public SearchTermsData {
public:
UIThreadSearchTermsData();
+ // Callers who need an accurate answer from InstantFieldTrialUrlParam() must
+ // set the profile here before calling that.
+ void set_profile(Profile* profile) { profile_ = profile; }
+
// Implementation of SearchTermsData.
virtual std::string GoogleBaseURLValue() const;
virtual std::string GetApplicationLocale() const;
@@ -48,12 +61,17 @@ class UIThreadSearchTermsData : public SearchTermsData {
virtual string16 GetRlzParameterValue() const;
#endif
+ // This returns the empty string unless set_profile() has been called with a
+ // non-NULL Profile.
+ virtual std::string InstantFieldTrialUrlParam() const;
+
// Used by tests to set the value for the Google base url. This takes
// ownership of the given std::string.
static void SetGoogleBaseURL(std::string* google_base_url);
private:
static std::string* google_base_url_;
+ Profile* profile_;
DISALLOW_COPY_AND_ASSIGN(UIThreadSearchTermsData);
};
« no previous file with comments | « chrome/browser/instant/instant_loader.cc ('k') | chrome/browser/search_engines/search_terms_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698