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

Side by Side Diff: components/omnibox/browser/autocomplete_match.cc

Issue 2816353002: Make const versions GetTemplateURLForKeyword, GetTemplateURLForGUID, GetTemplateURLForHost (Closed)
Patch Set: Make definition and declaration order of new functions match 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/omnibox/browser/autocomplete_match.h" 5 #include "components/omnibox/browser/autocomplete_match.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 if (!url.is_valid()) 428 if (!url.is_valid())
429 return url; 429 return url;
430 430
431 GURL stripped_destination_url = url; 431 GURL stripped_destination_url = url;
432 432
433 // If the destination URL looks like it was generated from a TemplateURL, 433 // If the destination URL looks like it was generated from a TemplateURL,
434 // remove all substitutions other than the search terms. This allows us 434 // remove all substitutions other than the search terms. This allows us
435 // to eliminate cases like past search URLs from history that differ only 435 // to eliminate cases like past search URLs from history that differ only
436 // by some obscure query param from each other or from the search/keyword 436 // by some obscure query param from each other or from the search/keyword
437 // provider matches. 437 // provider matches.
438 TemplateURL* template_url = GetTemplateURLWithKeyword( 438 const TemplateURL* template_url = GetTemplateURLWithKeyword(
439 template_url_service, keyword, stripped_destination_url.host()); 439 template_url_service, keyword, stripped_destination_url.host());
440 if (template_url != NULL && 440 if (template_url != NULL &&
441 template_url->SupportsReplacement( 441 template_url->SupportsReplacement(
442 template_url_service->search_terms_data())) { 442 template_url_service->search_terms_data())) {
443 base::string16 search_terms; 443 base::string16 search_terms;
444 if (template_url->ExtractSearchTermsFromURL( 444 if (template_url->ExtractSearchTermsFromURL(
445 stripped_destination_url, 445 stripped_destination_url,
446 template_url_service->search_terms_data(), 446 template_url_service->search_terms_data(),
447 &search_terms)) { 447 &search_terms)) {
448 stripped_destination_url = 448 stripped_destination_url =
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 << " is unsorted in relation to last offset of " << last_offset 623 << " is unsorted in relation to last offset of " << last_offset
624 << ". Provider: " << provider_name << "."; 624 << ". Provider: " << provider_name << ".";
625 DCHECK_LT(i->offset, text.length()) 625 DCHECK_LT(i->offset, text.length())
626 << " Classification of [" << i->offset << "," << text.length() 626 << " Classification of [" << i->offset << "," << text.length()
627 << "] is out of bounds for \"" << text << "\". Provider: " 627 << "] is out of bounds for \"" << text << "\". Provider: "
628 << provider_name << "."; 628 << provider_name << ".";
629 last_offset = i->offset; 629 last_offset = i->offset;
630 } 630 }
631 } 631 }
632 #endif 632 #endif
OLDNEW
« no previous file with comments | « components/omnibox/browser/autocomplete_controller.cc ('k') | components/omnibox/browser/base_search_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698