Chromium Code Reviews| Index: components/omnibox/autocomplete_match.cc |
| diff --git a/components/omnibox/autocomplete_match.cc b/components/omnibox/autocomplete_match.cc |
| index d19f8e9b56031961555e2f2db05fc075080bfaa3..b18886ae630d0a16692968bd180d05bb9209aab7 100644 |
| --- a/components/omnibox/autocomplete_match.cc |
| +++ b/components/omnibox/autocomplete_match.cc |
| @@ -4,6 +4,7 @@ |
| #include "components/omnibox/autocomplete_match.h" |
| +#include "base/command_line.h" |
| #include "base/i18n/time_formatting.h" |
| #include "base/logging.h" |
| #include "base/strings/string16.h" |
| @@ -13,6 +14,7 @@ |
| #include "base/strings/utf_string_conversions.h" |
| #include "base/time/time.h" |
| #include "components/omnibox/autocomplete_provider.h" |
| +#include "components/omnibox/omnibox_switches.h" |
| #include "components/omnibox/suggestion_answer.h" |
| #include "components/search_engines/template_url.h" |
| #include "components/search_engines/template_url_service.h" |
| @@ -526,6 +528,21 @@ bool AutocompleteMatch::SupportsDeletion() const { |
| return false; |
| } |
| +void AutocompleteMatch::PossiblySwapContentsAndDescriptionForURLSuggestion( |
| + const AutocompleteInput& input) { |
| + // For URL suggestions, swap contents and description on query-type inputs |
| + // if legal (under the constraint that contents must be non-empty) and |
| + // we're supposed to (due to about:flags). |
|
Peter Kasting
2015/05/21 21:55:33
Nit: I think this comment just restates the (fairl
Mark P
2015/05/22 22:51:29
Okay, removed. I only added the comment because I
|
| + if (!IsSearchType(type) && !description.empty() && |
| + base::CommandLine::ForCurrentProcess()-> |
| + HasSwitch(switches::kEmphasizeTitlesInOmniboxDropdown) && |
| + ((input.type() == metrics::OmniboxInputType::QUERY) || |
| + (input.type() == metrics::OmniboxInputType::FORCED_QUERY))) { |
| + std::swap(contents, description); |
| + std::swap(contents_class, description_class); |
| + } |
| +} |
| + |
| #ifndef NDEBUG |
| void AutocompleteMatch::Validate() const { |
| ValidateClassifications(contents, contents_class); |