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 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1343 } | 1343 } |
1344 } | 1344 } |
1345 } | 1345 } |
1346 return false; | 1346 return false; |
1347 } | 1347 } |
1348 | 1348 |
1349 bool TemplateURL::ReplaceSearchTermsInURL( | 1349 bool TemplateURL::ReplaceSearchTermsInURL( |
1350 const GURL& url, | 1350 const GURL& url, |
1351 const TemplateURLRef::SearchTermsArgs& search_terms_args, | 1351 const TemplateURLRef::SearchTermsArgs& search_terms_args, |
1352 const SearchTermsData& search_terms_data, | 1352 const SearchTermsData& search_terms_data, |
1353 GURL* result) { | 1353 GURL* result) const { |
1354 // TODO(beaudoin): Use AQS from |search_terms_args| too. | 1354 // TODO(beaudoin): Use AQS from |search_terms_args| too. |
1355 url::Parsed::ComponentType search_term_component; | 1355 url::Parsed::ComponentType search_term_component; |
1356 url::Component search_terms_position; | 1356 url::Component search_terms_position; |
1357 base::string16 search_terms; | 1357 base::string16 search_terms; |
1358 if (!FindSearchTermsInURL(url, search_terms_data, &search_terms, | 1358 if (!FindSearchTermsInURL(url, search_terms_data, &search_terms, |
1359 &search_term_component, &search_terms_position)) { | 1359 &search_term_component, &search_terms_position)) { |
1360 return false; | 1360 return false; |
1361 } | 1361 } |
1362 DCHECK(search_terms_position.is_nonempty()); | 1362 DCHECK(search_terms_position.is_nonempty()); |
1363 | 1363 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1522 // patterns. This means that given patterns | 1522 // patterns. This means that given patterns |
1523 // [ "http://foo/#q={searchTerms}", "http://foo/?q={searchTerms}" ], | 1523 // [ "http://foo/#q={searchTerms}", "http://foo/?q={searchTerms}" ], |
1524 // calling ExtractSearchTermsFromURL() on "http://foo/?q=bar#q=' would | 1524 // calling ExtractSearchTermsFromURL() on "http://foo/?q=bar#q=' would |
1525 // return false. This is important for at least Google, where such URLs | 1525 // return false. This is important for at least Google, where such URLs |
1526 // are invalid. | 1526 // are invalid. |
1527 return !search_terms->empty(); | 1527 return !search_terms->empty(); |
1528 } | 1528 } |
1529 } | 1529 } |
1530 return false; | 1530 return false; |
1531 } | 1531 } |
OLD | NEW |