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/autocomplete_match.h" | 5 #include "components/omnibox/autocomplete_match.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/i18n/time_formatting.h" | 8 #include "base/i18n/time_formatting.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 base::UTF16ToUTF8( | 499 base::UTF16ToUTF8( |
500 base::TimeFormatShortDateAndTime(value))); | 500 base::TimeFormatShortDateAndTime(value))); |
501 } | 501 } |
502 | 502 |
503 std::string AutocompleteMatch::GetAdditionalInfo( | 503 std::string AutocompleteMatch::GetAdditionalInfo( |
504 const std::string& property) const { | 504 const std::string& property) const { |
505 AdditionalInfo::const_iterator i(additional_info.find(property)); | 505 AdditionalInfo::const_iterator i(additional_info.find(property)); |
506 return (i == additional_info.end()) ? std::string() : i->second; | 506 return (i == additional_info.end()) ? std::string() : i->second; |
507 } | 507 } |
508 | 508 |
509 bool AutocompleteMatch::IsVerbatimType() const { | |
510 const bool is_keyword_verbatim_match = | |
511 (type == AutocompleteMatchType::SEARCH_OTHER_ENGINE && | |
512 provider != NULL && | |
513 provider->type() == AutocompleteProvider::TYPE_SEARCH); | |
514 return type == AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED || | |
515 type == AutocompleteMatchType::URL_WHAT_YOU_TYPED || | |
516 is_keyword_verbatim_match; | |
517 } | |
518 | |
519 bool AutocompleteMatch::SupportsDeletion() const { | 509 bool AutocompleteMatch::SupportsDeletion() const { |
520 if (deletable) | 510 if (deletable) |
521 return true; | 511 return true; |
522 | 512 |
523 for (ACMatches::const_iterator it(duplicate_matches.begin()); | 513 for (ACMatches::const_iterator it(duplicate_matches.begin()); |
524 it != duplicate_matches.end(); ++it) { | 514 it != duplicate_matches.end(); ++it) { |
525 if (it->deletable) | 515 if (it->deletable) |
526 return true; | 516 return true; |
527 } | 517 } |
528 return false; | 518 return false; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 << " is unsorted in relation to last offset of " << last_offset | 561 << " is unsorted in relation to last offset of " << last_offset |
572 << ". Provider: " << provider_name << "."; | 562 << ". Provider: " << provider_name << "."; |
573 DCHECK_LT(i->offset, text.length()) | 563 DCHECK_LT(i->offset, text.length()) |
574 << " Classification of [" << i->offset << "," << text.length() | 564 << " Classification of [" << i->offset << "," << text.length() |
575 << "] is out of bounds for \"" << text << "\". Provider: " | 565 << "] is out of bounds for \"" << text << "\". Provider: " |
576 << provider_name << "."; | 566 << provider_name << "."; |
577 last_offset = i->offset; | 567 last_offset = i->offset; |
578 } | 568 } |
579 } | 569 } |
580 #endif | 570 #endif |
OLD | NEW |