Index: chrome/browser/search_engines/template_url.cc |
diff --git a/chrome/browser/search_engines/template_url.cc b/chrome/browser/search_engines/template_url.cc |
index bf85e4ab66f1e9f7ef5b15855f01155e68bcc52a..304808e9fa77a7ca31aa74f246b88bf0adfbc084 100644 |
--- a/chrome/browser/search_engines/template_url.cc |
+++ b/chrome/browser/search_engines/template_url.cc |
@@ -12,6 +12,7 @@ |
#include "base/stringprintf.h" |
#include "base/string_number_conversions.h" |
#include "base/utf_string_conversions.h" |
+#include "chrome/browser/instant/instant_field_trial.h" |
#include "chrome/browser/search_engines/search_engine_type.h" |
#include "chrome/browser/search_engines/search_terms_data.h" |
#include "chrome/browser/search_engines/template_url_service.h" |
@@ -62,6 +63,8 @@ static const char kGoogleUnescapedSearchTermsParameter[] = |
"google:unescapedSearchTerms"; |
static const char kGoogleUnescapedSearchTermsParameterFull[] = |
"{google:unescapedSearchTerms}"; |
+static const char kInstantFieldTrialGroupParameter[] = |
+ "instantFieldTrialGroupParameter"; |
sky
2011/08/08 23:37:23
Since this is google specific, use google:
sreeram
2011/08/09 16:24:01
Done. Will reflect it in the next patch.
|
// Display value for kSearchTermsParameter. |
static const char kDisplaySearchTerms[] = "%s"; |
@@ -155,6 +158,8 @@ bool TemplateURLRef::ParseParameter(size_t start, |
replacements->push_back(Replacement(GOOGLE_SEARCH_FIELDTRIAL_GROUP, start)); |
} else if (parameter == kGoogleUnescapedSearchTermsParameter) { |
replacements->push_back(Replacement(GOOGLE_UNESCAPED_SEARCH_TERMS, start)); |
+ } else if (parameter == kInstantFieldTrialGroupParameter) { |
+ replacements->push_back(Replacement(INSTANT_FIELD_TRIAL_GROUP, start)); |
} else { |
// If it's a prepopulated URL, we know that it's safe to remove unknown |
// parameters. Otherwise it could be some garbage but can also be a |
@@ -276,12 +281,14 @@ void TemplateURLRef::SetGoogleBaseURL(std::string* google_base_url) { |
} |
std::string TemplateURLRef::ReplaceSearchTerms( |
+ Profile* profile, |
const TemplateURL& host, |
const string16& terms, |
int accepted_suggestion, |
const string16& original_query_for_suggestion) const { |
UIThreadSearchTermsData search_terms_data; |
- return ReplaceSearchTermsUsingTermsData(host, |
+ return ReplaceSearchTermsUsingTermsData(profile, |
+ host, |
terms, |
accepted_suggestion, |
original_query_for_suggestion, |
@@ -289,6 +296,7 @@ std::string TemplateURLRef::ReplaceSearchTerms( |
} |
std::string TemplateURLRef::ReplaceSearchTermsUsingTermsData( |
+ Profile* profile, |
const TemplateURL& host, |
const string16& terms, |
int accepted_suggestion, |
@@ -417,6 +425,11 @@ std::string TemplateURLRef::ReplaceSearchTermsUsingTermsData( |
break; |
} |
+ case INSTANT_FIELD_TRIAL_GROUP: |
+ if (profile != NULL) |
+ url.insert(i->index, InstantFieldTrial::GetGroupAsUrlParam(profile)); |
+ break; |
+ |
case LANGUAGE: |
url.insert(i->index, search_terms_data.GetApplicationLocale()); |
break; |
@@ -665,7 +678,8 @@ void TemplateURL::EnsureKeyword() const { |
if (autogenerate_keyword_ && !keyword_generated_) { |
// Generate a keyword and cache it. |
keyword_ = TemplateURLService::GenerateKeyword( |
- TemplateURLService::GenerateSearchURL(this).GetWithEmptyPath(), true); |
+ TemplateURLService::GenerateSearchURL(NULL, this).GetWithEmptyPath(), |
+ true); |
keyword_generated_ = true; |
} |
} |