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/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 } | 330 } |
331 if (!search_terms_args.suggest_query_params.empty()) | 331 if (!search_terms_args.suggest_query_params.empty()) |
332 query_params.push_back(search_terms_args.suggest_query_params); | 332 query_params.push_back(search_terms_args.suggest_query_params); |
333 if (!gurl.query().empty()) | 333 if (!gurl.query().empty()) |
334 query_params.push_back(gurl.query()); | 334 query_params.push_back(gurl.query()); |
335 | 335 |
336 if (query_params.empty()) | 336 if (query_params.empty()) |
337 return url; | 337 return url; |
338 | 338 |
339 GURL::Replacements replacements; | 339 GURL::Replacements replacements; |
340 std::string query_str = JoinString(query_params, "&"); | 340 std::string query_str = base::JoinString(query_params, "&"); |
341 replacements.SetQueryStr(query_str); | 341 replacements.SetQueryStr(query_str); |
342 return gurl.ReplaceComponents(replacements).possibly_invalid_spec(); | 342 return gurl.ReplaceComponents(replacements).possibly_invalid_spec(); |
343 } | 343 } |
344 | 344 |
345 bool TemplateURLRef::IsValid(const SearchTermsData& search_terms_data) const { | 345 bool TemplateURLRef::IsValid(const SearchTermsData& search_terms_data) const { |
346 ParseIfNecessary(search_terms_data); | 346 ParseIfNecessary(search_terms_data); |
347 return valid_; | 347 return valid_; |
348 } | 348 } |
349 | 349 |
350 base::string16 TemplateURLRef::DisplayURL( | 350 base::string16 TemplateURLRef::DisplayURL( |
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1509 // patterns. This means that given patterns | 1509 // patterns. This means that given patterns |
1510 // [ "http://foo/#q={searchTerms}", "http://foo/?q={searchTerms}" ], | 1510 // [ "http://foo/#q={searchTerms}", "http://foo/?q={searchTerms}" ], |
1511 // calling ExtractSearchTermsFromURL() on "http://foo/?q=bar#q=' would | 1511 // calling ExtractSearchTermsFromURL() on "http://foo/?q=bar#q=' would |
1512 // return false. This is important for at least Google, where such URLs | 1512 // return false. This is important for at least Google, where such URLs |
1513 // are invalid. | 1513 // are invalid. |
1514 return !search_terms->empty(); | 1514 return !search_terms->empty(); |
1515 } | 1515 } |
1516 } | 1516 } |
1517 return false; | 1517 return false; |
1518 } | 1518 } |
OLD | NEW |