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 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1322 } | 1322 } |
1323 } | 1323 } |
1324 } | 1324 } |
1325 return false; | 1325 return false; |
1326 } | 1326 } |
1327 | 1327 |
1328 bool TemplateURL::ReplaceSearchTermsInURL( | 1328 bool TemplateURL::ReplaceSearchTermsInURL( |
1329 const GURL& url, | 1329 const GURL& url, |
1330 const TemplateURLRef::SearchTermsArgs& search_terms_args, | 1330 const TemplateURLRef::SearchTermsArgs& search_terms_args, |
1331 const SearchTermsData& search_terms_data, | 1331 const SearchTermsData& search_terms_data, |
1332 GURL* result) { | 1332 GURL* result) const { |
1333 // TODO(beaudoin): Use AQS from |search_terms_args| too. | 1333 // TODO(beaudoin): Use AQS from |search_terms_args| too. |
1334 url::Parsed::ComponentType search_term_component; | 1334 url::Parsed::ComponentType search_term_component; |
1335 url::Component search_terms_position; | 1335 url::Component search_terms_position; |
1336 base::string16 search_terms; | 1336 base::string16 search_terms; |
1337 if (!FindSearchTermsInURL(url, search_terms_data, &search_terms, | 1337 if (!FindSearchTermsInURL(url, search_terms_data, &search_terms, |
1338 &search_term_component, &search_terms_position)) { | 1338 &search_term_component, &search_terms_position)) { |
1339 return false; | 1339 return false; |
1340 } | 1340 } |
1341 DCHECK(search_terms_position.is_nonempty()); | 1341 DCHECK(search_terms_position.is_nonempty()); |
1342 | 1342 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1501 // patterns. This means that given patterns | 1501 // patterns. This means that given patterns |
1502 // [ "http://foo/#q={searchTerms}", "http://foo/?q={searchTerms}" ], | 1502 // [ "http://foo/#q={searchTerms}", "http://foo/?q={searchTerms}" ], |
1503 // calling ExtractSearchTermsFromURL() on "http://foo/?q=bar#q=' would | 1503 // calling ExtractSearchTermsFromURL() on "http://foo/?q=bar#q=' would |
1504 // return false. This is important for at least Google, where such URLs | 1504 // return false. This is important for at least Google, where such URLs |
1505 // are invalid. | 1505 // are invalid. |
1506 return !search_terms->empty(); | 1506 return !search_terms->empty(); |
1507 } | 1507 } |
1508 } | 1508 } |
1509 return false; | 1509 return false; |
1510 } | 1510 } |
OLD | NEW |