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

Unified Diff: components/omnibox/autocomplete_match.cc

Issue 1155673002: Omnibox - Add About Flag to Reverse Title and URLs in the Dropdown (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: peter's comments, including refactoring Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: components/omnibox/autocomplete_match.cc
diff --git a/components/omnibox/autocomplete_match.cc b/components/omnibox/autocomplete_match.cc
index d19f8e9b56031961555e2f2db05fc075080bfaa3..8bd091745b8ebf50fe4f9c7e7f8575776c44b157 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,18 @@ bool AutocompleteMatch::SupportsDeletion() const {
return false;
}
+void AutocompleteMatch::PossiblySwapContentsAndDescriptionForURLSuggestion(
+ const AutocompleteInput& input) {
+ 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);

Powered by Google App Engine
This is Rietveld 408576698