Index: components/search_engines/template_url.cc |
diff --git a/components/search_engines/template_url.cc b/components/search_engines/template_url.cc |
index b4fb151639c6799de44dc0008764ebc6a051e3c2..2bb5fe9f0c9cb8e983c0273b743de9ed57b95d20 100644 |
--- a/components/search_engines/template_url.cc |
+++ b/components/search_engines/template_url.cc |
@@ -649,6 +649,8 @@ bool TemplateURLRef::ParseParameter(size_t start, |
replacements->push_back(Replacement(GOOGLE_SUGGEST_REQUEST_ID, start)); |
} else if (parameter == kGoogleUnescapedSearchTermsParameter) { |
replacements->push_back(Replacement(GOOGLE_UNESCAPED_SEARCH_TERMS, start)); |
+ } else if (parameter == "yandex:referralID") { |
+ replacements->push_back(Replacement(YANDEX_REFERRAL_ID, start)); |
} else if (parameter == "yandex:searchPath") { |
switch (ui::GetDeviceFormFactor()) { |
case ui::DEVICE_FORM_FACTOR_DESKTOP: |
@@ -1125,6 +1127,18 @@ std::string TemplateURLRef::HandleReplacements( |
#endif |
break; |
+ case YANDEX_REFERRAL_ID: { |
+ DCHECK(!i->is_post_param); |
Peter Kasting
2017/05/09 00:14:25
Is this important? Why?
Ted C
2017/05/09 04:38:32
this and the comment below were blatantly cribbed
|
+ // On platforms that don't have Referral ID, we still want this branch |
+ // to happen so that we replace the Referral ID template with the |
+ // empty string. (If we don't handle this case, we hit a |
+ // NOTREACHED below.) |
Peter Kasting
2017/05/09 00:14:25
I'm confused. Is this referring to having a case
|
+ std::string referral_id = search_terms_data.YandexReferralID(); |
+ if (!referral_id.empty()) |
+ HandleReplacement("clid", referral_id, *i, &url); |
+ break; |
+ } |
+ |
default: |
NOTREACHED(); |
break; |