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

Unified Diff: chrome/browser/ui/extensions/extension_action_view_controller.cc

Issue 1454753002: Resize extension action icons to 16x16 in material design (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/extensions/extension_action_view_controller.cc
diff --git a/chrome/browser/ui/extensions/extension_action_view_controller.cc b/chrome/browser/ui/extensions/extension_action_view_controller.cc
index 22decd3e8b3722b3f9954be79cad5646f71c9bc0..84ed17a644d8b4d1ea4da7374b1a74bf50d5b286 100644
--- a/chrome/browser/ui/extensions/extension_action_view_controller.cc
+++ b/chrome/browser/ui/extensions/extension_action_view_controller.cc
@@ -27,6 +27,7 @@
#include "extensions/common/extension.h"
#include "extensions/common/feature_switch.h"
#include "extensions/common/manifest_constants.h"
+#include "ui/base/resource/material_design/material_design_controller.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/image/image_skia_operations.h"
@@ -364,7 +365,18 @@ ExtensionActionViewController::GetIconImageSource(
int tab_id = SessionTabHelper::IdForTab(web_contents);
scoped_ptr<IconWithBadgeImageSource> image_source(
new IconWithBadgeImageSource(size));
- image_source->SetIcon(icon_factory_.GetIcon(tab_id));
+
+ gfx::Image icon(icon_factory_.GetIcon(tab_id));
+ if (ui::MaterialDesignController::IsModeMaterial()) {
+ // TODO(tdanderson): Use a 16x16 icon if it exists instead of resizing.
+ icon = gfx::Image(gfx::ImageSkiaOperations::CreateResizedImage(
+ *icon.ToImageSkia(),
+ skia::ImageOperations::RESIZE_BEST,
+ gfx::Size(extension_misc::EXTENSION_ICON_BITTY,
+ extension_misc::EXTENSION_ICON_BITTY)));
+ }
+ image_source->SetIcon(icon);
+
scoped_ptr<IconWithBadgeImageSource::Badge> badge;
std::string badge_text = extension_action_->GetBadgeText(tab_id);
if (!badge_text.empty()) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698