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

Unified Diff: chrome/browser/ui/views/omnibox/omnibox_result_view.cc

Issue 1418543002: Vectorize omnibox dropdown icons (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: notreached 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
Index: chrome/browser/ui/views/omnibox/omnibox_result_view.cc
diff --git a/chrome/browser/ui/views/omnibox/omnibox_result_view.cc b/chrome/browser/ui/views/omnibox/omnibox_result_view.cc
index 9a640a68870fe6839295d5fb33e32bd69f3674c5..e91d997c41bab7c7e4dd058ec9657943faa7de34 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_result_view.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_result_view.cc
@@ -30,11 +30,14 @@
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/theme_provider.h"
#include "ui/gfx/canvas.h"
+#include "ui/gfx/color_palette.h"
#include "ui/gfx/color_utils.h"
#include "ui/gfx/image/image.h"
+#include "ui/gfx/paint_vector_icon.h"
#include "ui/gfx/range/range.h"
#include "ui/gfx/render_text.h"
#include "ui/gfx/text_utils.h"
+#include "ui/gfx/vector_icons_public.h"
using ui::NativeTheme;
@@ -567,10 +570,12 @@ gfx::ImageSkia OmniboxResultView::GetIcon() const {
if (!image.IsEmpty())
return image.AsImageSkia();
+ if (ui::MaterialDesignController::IsModeMaterial())
+ return GetMaterialIcon();
Peter Kasting 2015/10/20 01:02:59 Nit: I dunno if separating this into its own helpe
Evan Stade 2015/10/20 01:12:09 Done.
+
int icon = model_->IsStarredMatch(match_) ?
IDR_OMNIBOX_STAR : AutocompleteMatch::TypeToIcon(match_.type);
- if (GetState() == SELECTED &&
- !ui::MaterialDesignController::IsModeMaterial()) {
+ if (GetState() == SELECTED) {
switch (icon) {
case IDR_OMNIBOX_CALCULATOR:
icon = IDR_OMNIBOX_CALCULATOR_SELECTED;
@@ -595,6 +600,13 @@ gfx::ImageSkia OmniboxResultView::GetIcon() const {
return *(location_bar_view_->GetThemeProvider()->GetImageSkiaNamed(icon));
}
+gfx::ImageSkia OmniboxResultView::GetMaterialIcon() const {
+ gfx::VectorIconId icon_id = model_->IsStarredMatch(match_) ?
+ gfx::VectorIconId::OMNIBOX_STAR :
+ AutocompleteMatch::TypeToVectorIcon(match_.type);
+ return gfx::CreateVectorIcon(icon_id, 16, gfx::kChromeIconGrey);
Peter Kasting 2015/10/20 01:02:59 Using grey here will be problematic for dropdowns
Evan Stade 2015/10/20 01:12:09 I didn't even realize the dropdown could change. I
Peter Kasting 2015/10/20 01:39:18 Yes. It's supposed to use the system window color
+}
+
const gfx::ImageSkia* OmniboxResultView::GetKeywordIcon() const {
// NOTE: If we ever begin returning icons of varying size, then callers need
// to ensure that |keyword_icon_| is resized each time its image is reset.

Powered by Google App Engine
This is Rietveld 408576698