Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/search_engines/template_url.h" | 5 #include "components/search_engines/template_url.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 181 default; | 181 default; |
| 182 | 182 |
| 183 TemplateURLRef::SearchTermsArgs::~SearchTermsArgs() { | 183 TemplateURLRef::SearchTermsArgs::~SearchTermsArgs() { |
| 184 } | 184 } |
| 185 | 185 |
| 186 TemplateURLRef::SearchTermsArgs::ContextualSearchParams:: | 186 TemplateURLRef::SearchTermsArgs::ContextualSearchParams:: |
| 187 ContextualSearchParams() | 187 ContextualSearchParams() |
| 188 : version(-1), | 188 : version(-1), |
| 189 start(base::string16::npos), | 189 start(base::string16::npos), |
| 190 end(base::string16::npos), | 190 end(base::string16::npos), |
| 191 resolve(true) { | 191 now_on_tap_version(0) {} |
| 192 } | |
| 193 | 192 |
| 194 TemplateURLRef::SearchTermsArgs::ContextualSearchParams:: | 193 TemplateURLRef::SearchTermsArgs::ContextualSearchParams::ContextualSearchParams( |
| 195 ContextualSearchParams( | 194 const int version, |
| 196 const int version, | 195 const std::string& selection, |
| 197 const std::string& selection, | 196 const std::string& base_page_url, |
| 198 const std::string& base_page_url, | 197 const int now_on_tap_version) |
| 199 const bool resolve) | |
| 200 : version(version), | 198 : version(version), |
| 201 start(base::string16::npos), | 199 start(base::string16::npos), |
| 202 end(base::string16::npos), | 200 end(base::string16::npos), |
| 203 selection(selection), | 201 selection(selection), |
| 204 base_page_url(base_page_url), | 202 base_page_url(base_page_url), |
| 205 resolve(resolve) { | 203 now_on_tap_version(now_on_tap_version) {} |
| 206 } | |
| 207 | 204 |
| 208 TemplateURLRef::SearchTermsArgs::ContextualSearchParams:: | 205 TemplateURLRef::SearchTermsArgs::ContextualSearchParams::ContextualSearchParams( |
| 209 ContextualSearchParams( | 206 const int version, |
| 210 const int version, | 207 const size_t start, |
| 211 const size_t start, | 208 const size_t end, |
| 212 const size_t end, | 209 const std::string& selection, |
| 213 const std::string& selection, | 210 const std::string& content, |
| 214 const std::string& content, | 211 const std::string& base_page_url, |
| 215 const std::string& base_page_url, | 212 const std::string& encoding, |
| 216 const std::string& encoding, | 213 const int now_on_tap_version) |
| 217 const bool resolve) | |
| 218 : version(version), | 214 : version(version), |
| 219 start(start), | 215 start(start), |
| 220 end(end), | 216 end(end), |
| 221 selection(selection), | 217 selection(selection), |
| 222 content(content), | 218 content(content), |
| 223 base_page_url(base_page_url), | 219 base_page_url(base_page_url), |
| 224 encoding(encoding), | 220 encoding(encoding), |
| 225 resolve(resolve) { | 221 now_on_tap_version(now_on_tap_version) {} |
| 226 } | |
| 227 | 222 |
| 228 TemplateURLRef::SearchTermsArgs::ContextualSearchParams::ContextualSearchParams( | 223 TemplateURLRef::SearchTermsArgs::ContextualSearchParams::ContextualSearchParams( |
| 229 const ContextualSearchParams& other) = default; | 224 const ContextualSearchParams& other) = default; |
| 230 | 225 |
| 231 TemplateURLRef::SearchTermsArgs::ContextualSearchParams:: | 226 TemplateURLRef::SearchTermsArgs::ContextualSearchParams:: |
| 232 ~ContextualSearchParams() { | 227 ~ContextualSearchParams() { |
| 233 } | 228 } |
| 234 | 229 |
| 235 // TemplateURLRef ------------------------------------------------------------- | 230 // TemplateURLRef ------------------------------------------------------------- |
| 236 | 231 |
| (...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1013 if (!params.content.empty()) | 1008 if (!params.content.empty()) |
| 1014 context_data.append("ctxs_content=" + params.content + "&"); | 1009 context_data.append("ctxs_content=" + params.content + "&"); |
| 1015 | 1010 |
| 1016 if (!params.base_page_url.empty()) | 1011 if (!params.base_page_url.empty()) |
| 1017 context_data.append("ctxsl_url=" + params.base_page_url + "&"); | 1012 context_data.append("ctxsl_url=" + params.base_page_url + "&"); |
| 1018 | 1013 |
| 1019 if (!params.encoding.empty()) { | 1014 if (!params.encoding.empty()) { |
| 1020 context_data.append("ctxs_encoding=" + params.encoding + "&"); | 1015 context_data.append("ctxs_encoding=" + params.encoding + "&"); |
| 1021 } | 1016 } |
| 1022 | 1017 |
| 1023 context_data.append( | 1018 std::string now_on_tap_version( |
| 1024 params.resolve ? "ctxsl_resolve=1" : "ctxsl_resolve=0"); | 1019 base::IntToString(params.now_on_tap_version)); |
|
Theresa
2016/09/15 05:03:32
Do we still need to append ctxsl_resolve=1 or does
Donn Denman
2016/09/15 22:00:00
Verified that it's not needed.
Independently I
| |
| 1020 context_data.append("ctxsl_coca=" + now_on_tap_version); | |
| 1025 | 1021 |
| 1026 HandleReplacement(std::string(), context_data, *i, &url); | 1022 HandleReplacement(std::string(), context_data, *i, &url); |
| 1027 break; | 1023 break; |
| 1028 } | 1024 } |
| 1029 | 1025 |
| 1030 case GOOGLE_ORIGINAL_QUERY_FOR_SUGGESTION: | 1026 case GOOGLE_ORIGINAL_QUERY_FOR_SUGGESTION: |
| 1031 DCHECK(!i->is_post_param); | 1027 DCHECK(!i->is_post_param); |
| 1032 if (search_terms_args.accepted_suggestion >= 0 || | 1028 if (search_terms_args.accepted_suggestion >= 0 || |
| 1033 !search_terms_args.assisted_query_stats.empty()) { | 1029 !search_terms_args.assisted_query_stats.empty()) { |
| 1034 HandleReplacement( | 1030 HandleReplacement( |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1553 // patterns. This means that given patterns | 1549 // patterns. This means that given patterns |
| 1554 // [ "http://foo/#q={searchTerms}", "http://foo/?q={searchTerms}" ], | 1550 // [ "http://foo/#q={searchTerms}", "http://foo/?q={searchTerms}" ], |
| 1555 // calling ExtractSearchTermsFromURL() on "http://foo/?q=bar#q=' would | 1551 // calling ExtractSearchTermsFromURL() on "http://foo/?q=bar#q=' would |
| 1556 // return false. This is important for at least Google, where such URLs | 1552 // return false. This is important for at least Google, where such URLs |
| 1557 // are invalid. | 1553 // are invalid. |
| 1558 return !search_terms->empty(); | 1554 return !search_terms->empty(); |
| 1559 } | 1555 } |
| 1560 } | 1556 } |
| 1561 return false; | 1557 return false; |
| 1562 } | 1558 } |
| OLD | NEW |