| 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/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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |