Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: components/search_engines/template_url.cc

Issue 2816383002: Remove non-const version of GetDefaultSearchProvider() and make all callers call the const version (Closed)
Patch Set: Fix unit test (the model was already loaded) Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « components/search_engines/template_url.h ('k') | components/search_engines/template_url_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698