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

Unified Diff: ash/common/system/web_notification/web_notification_tray.cc

Issue 2351213002: Re-add size parameter to WebNotificationImage for notification center (Closed)
Patch Set: Created 4 years, 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/system/web_notification/web_notification_tray.cc
diff --git a/ash/common/system/web_notification/web_notification_tray.cc b/ash/common/system/web_notification/web_notification_tray.cc
index 5ab4fc0d0562957a36679d02720355849568a9cd..078c811f8db067fe46c61616e52f7fa2c5b5d49e 100644
--- a/ash/common/system/web_notification/web_notification_tray.cc
+++ b/ash/common/system/web_notification/web_notification_tray.cc
@@ -67,6 +67,8 @@ constexpr int kEnableQuietModeDay = 2;
constexpr int kMaximumSmallIconCount = 3;
+constexpr gfx::Size kTrayItemInnerIconSize(16, 16);
+constexpr gfx::Size kTrayItemInnerBellIconSizeNonMd(18, 18);
constexpr gfx::Size kTrayItemOuterSize(26, 26);
constexpr gfx::Insets kTrayItemInsets(3, 3);
@@ -240,11 +242,13 @@ class WebNotificationItem : public views::View, public gfx::AnimationDelegate {
class WebNotificationImage : public WebNotificationItem {
public:
WebNotificationImage(const gfx::ImageSkia& image,
+ const gfx::Size& size,
gfx::AnimationContainer* container,
WebNotificationTray* tray)
: WebNotificationItem(container, tray) {
view_ = new views::ImageView();
view_->SetImage(image);
+ view_->SetImageSize(size);
AddChildView(view_);
}
@@ -302,12 +306,15 @@ WebNotificationTray::WebNotificationTray(WmShelf* shelf,
DCHECK(status_area_window_);
DCHECK(system_tray_);
+ const bool md_shelf = MaterialDesignController::IsShelfMaterial();
gfx::ImageSkia bell_image =
- MaterialDesignController::IsShelfMaterial()
+ md_shelf
? CreateVectorIcon(kShelfNotificationsIcon, kShelfIconColor)
: CreateVectorIcon(gfx::VectorIconId::NOTIFICATIONS,
kNoUnreadIconSize, kWebNotificationColorNoUnread);
- bell_icon_.reset(new WebNotificationImage(bell_image,
+ const gfx::Size bell_icon_size =
+ md_shelf ? kTrayItemInnerIconSize : kTrayItemInnerBellIconSizeNonMd;
+ bell_icon_.reset(new WebNotificationImage(bell_image, bell_icon_size,
animation_container_.get(), this));
tray_container()->AddChildView(bell_icon_.get());
@@ -592,8 +599,9 @@ void WebNotificationTray::UpdateTrayContent() {
if (visible_small_icons_.count(notification->id()) != 0)
continue;
- auto* item = new WebNotificationImage(image.AsImageSkia(),
- animation_container_.get(), this);
+ auto* item =
+ new WebNotificationImage(image.AsImageSkia(), kTrayItemInnerIconSize,
+ animation_container_.get(), this);
visible_small_icons_.insert(std::make_pair(notification->id(), item));
tray_container()->AddChildViewAt(item, 0);
« 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