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); |
}; |