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

Unified Diff: components/omnibox/browser/autocomplete_match.cc

Issue 1418543002: Vectorize omnibox dropdown icons (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add gyp dependency Created 5 years, 2 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
« no previous file with comments | « components/omnibox/browser/autocomplete_match.h ('k') | ui/gfx/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/omnibox/browser/autocomplete_match.cc
diff --git a/components/omnibox/browser/autocomplete_match.cc b/components/omnibox/browser/autocomplete_match.cc
index 326376fcd8dbb82bbb6b13f6c215698386f574fb..bbcce7f1c31057f5f2b8828bcbe9bbfcdf63a3a1 100644
--- a/components/omnibox/browser/autocomplete_match.cc
+++ b/components/omnibox/browser/autocomplete_match.cc
@@ -19,6 +19,7 @@
#include "components/search_engines/template_url_service.h"
#include "components/url_formatter/url_formatter.h"
#include "grit/components_scaled_resources.h"
+#include "ui/gfx/vector_icons_public.h"
namespace {
@@ -220,6 +221,40 @@ int AutocompleteMatch::TypeToIcon(Type type) {
}
// static
+gfx::VectorIconId AutocompleteMatch::TypeToVectorIcon(Type type) {
+#if !defined(OS_ANDROID) && !defined(OS_MACOSX) && !defined(OS_IOS)
+ static const gfx::VectorIconId kIcons[] = {
+ gfx::VectorIconId::OMNIBOX_HTTP, // URL_WHAT_YOU_TYPE
+ gfx::VectorIconId::OMNIBOX_HTTP, // HISTORY_URL
+ gfx::VectorIconId::OMNIBOX_HTTP, // HISTORY_TITLE
+ gfx::VectorIconId::OMNIBOX_HTTP, // HISTORY_BODY
+ gfx::VectorIconId::OMNIBOX_HTTP, // HISTORY_KEYWORD
+ gfx::VectorIconId::OMNIBOX_HTTP, // NAVSUGGEST
+ gfx::VectorIconId::OMNIBOX_SEARCH, // SEARCH_WHAT_YOU_TYPED
+ gfx::VectorIconId::OMNIBOX_SEARCH, // SEARCH_HISTORY
+ gfx::VectorIconId::OMNIBOX_SEARCH, // SEARCH_SUGGEST
+ gfx::VectorIconId::OMNIBOX_SEARCH, // SEARCH_SUGGEST_ENTITY
+ gfx::VectorIconId::OMNIBOX_SEARCH, // SEARCH_SUGGEST_TAIL
+ gfx::VectorIconId::OMNIBOX_SEARCH, // SEARCH_SUGGEST_PERSONALIZED
+ gfx::VectorIconId::OMNIBOX_SEARCH, // SEARCH_SUGGEST_PROFILE
+ gfx::VectorIconId::OMNIBOX_SEARCH, // SEARCH_OTHER_ENGINE
+ gfx::VectorIconId::OMNIBOX_EXTENSION_APP, // EXTENSION_APP
+ gfx::VectorIconId::OMNIBOX_SEARCH, // CONTACT_DEPRECATED
+ gfx::VectorIconId::OMNIBOX_HTTP, // BOOKMARK_TITLE
+ gfx::VectorIconId::OMNIBOX_HTTP, // NAVSUGGEST_PERSONALIZED
+ gfx::VectorIconId::OMNIBOX_CALCULATOR, // CALCULATOR
+ gfx::VectorIconId::OMNIBOX_HTTP, // CLIPBOARD
+ };
+ static_assert(arraysize(kIcons) == AutocompleteMatchType::NUM_TYPES,
+ "icons array must have NUM_TYPES elements");
+ return kIcons[type];
+#else
+ NOTREACHED();
+ return gfx::VectorIconId::VECTOR_ICON_NONE;
+#endif
+}
+
+// static
bool AutocompleteMatch::MoreRelevant(const AutocompleteMatch& elem1,
const AutocompleteMatch& elem2) {
// For equal-relevance matches, we sort alphabetically, so that providers
« no previous file with comments | « components/omnibox/browser/autocomplete_match.h ('k') | ui/gfx/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698