Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/autocomplete/autocomplete_match.h" | 5 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| 6 | 6 |
| 7 #include "base/i18n/time_formatting.h" | 7 #include "base/i18n/time_formatting.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 335 | 335 |
| 336 // static | 336 // static |
| 337 bool AutocompleteMatch::IsSearchType(Type type) { | 337 bool AutocompleteMatch::IsSearchType(Type type) { |
| 338 return type == AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED || | 338 return type == AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED || |
| 339 type == AutocompleteMatchType::SEARCH_HISTORY || | 339 type == AutocompleteMatchType::SEARCH_HISTORY || |
| 340 type == AutocompleteMatchType::SEARCH_SUGGEST || | 340 type == AutocompleteMatchType::SEARCH_SUGGEST || |
| 341 type == AutocompleteMatchType::SEARCH_SUGGEST_ENTITY || | 341 type == AutocompleteMatchType::SEARCH_SUGGEST_ENTITY || |
| 342 type == AutocompleteMatchType::SEARCH_SUGGEST_INFINITE || | 342 type == AutocompleteMatchType::SEARCH_SUGGEST_INFINITE || |
| 343 type == AutocompleteMatchType::SEARCH_SUGGEST_PERSONALIZED || | 343 type == AutocompleteMatchType::SEARCH_SUGGEST_PERSONALIZED || |
| 344 type == AutocompleteMatchType::SEARCH_SUGGEST_PROFILE || | 344 type == AutocompleteMatchType::SEARCH_SUGGEST_PROFILE || |
| 345 type == AutocompleteMatchType::SEARCH_OTHER_ENGINE; | 345 type == AutocompleteMatchType::SEARCH_OTHER_ENGINE; |
|
Peter Kasting
2014/03/21 18:36:26
Nit: Can simplify by removing everything covered b
Anuj
2014/03/24 07:16:16
Done.
| |
| 346 } | 346 } |
| 347 | 347 |
| 348 // static | |
| 349 bool AutocompleteMatch::IsSearchSuggestType(Type type) { | |
| 350 return type == AutocompleteMatchType::SEARCH_SUGGEST_ENTITY || | |
| 351 type == AutocompleteMatchType::SEARCH_SUGGEST_INFINITE || | |
| 352 type == AutocompleteMatchType::SEARCH_SUGGEST_PERSONALIZED || | |
| 353 type == AutocompleteMatchType::SEARCH_SUGGEST_PROFILE; | |
| 354 } | |
| 355 | |
| 348 void AutocompleteMatch::ComputeStrippedDestinationURL(Profile* profile) { | 356 void AutocompleteMatch::ComputeStrippedDestinationURL(Profile* profile) { |
| 349 stripped_destination_url = destination_url; | 357 stripped_destination_url = destination_url; |
| 350 if (!stripped_destination_url.is_valid()) | 358 if (!stripped_destination_url.is_valid()) |
| 351 return; | 359 return; |
| 352 | 360 |
| 353 // If the destination URL looks like it was generated from a TemplateURL, | 361 // If the destination URL looks like it was generated from a TemplateURL, |
| 354 // remove all substitutions other than the search terms. This allows us | 362 // remove all substitutions other than the search terms. This allows us |
| 355 // to eliminate cases like past search URLs from history that differ only | 363 // to eliminate cases like past search URLs from history that differ only |
| 356 // by some obscure query param from each other or from the search/keyword | 364 // by some obscure query param from each other or from the search/keyword |
| 357 // provider matches. | 365 // provider matches. |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 506 << " is unsorted in relation to last offset of " << last_offset | 514 << " is unsorted in relation to last offset of " << last_offset |
| 507 << ". Provider: " << provider_name << "."; | 515 << ". Provider: " << provider_name << "."; |
| 508 DCHECK_LT(i->offset, text.length()) | 516 DCHECK_LT(i->offset, text.length()) |
| 509 << " Classification of [" << i->offset << "," << text.length() | 517 << " Classification of [" << i->offset << "," << text.length() |
| 510 << "] is out of bounds for \"" << text << "\". Provider: " | 518 << "] is out of bounds for \"" << text << "\". Provider: " |
| 511 << provider_name << "."; | 519 << provider_name << "."; |
| 512 last_offset = i->offset; | 520 last_offset = i->offset; |
| 513 } | 521 } |
| 514 } | 522 } |
| 515 #endif | 523 #endif |
| OLD | NEW |