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

Unified Diff: ash/shelf/overflow_button.cc

Issue 2033553003: Add MD ink drop ripple to shelf app items (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased (after r398375) Created 4 years, 6 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: ash/shelf/overflow_button.cc
diff --git a/ash/shelf/overflow_button.cc b/ash/shelf/overflow_button.cc
index f80c903a845df1f47389774fec603ff4cc652433..6599c844b02d0e1cad88c212226004e8c9dd7fa3 100644
--- a/ash/shelf/overflow_button.cc
+++ b/ash/shelf/overflow_button.cc
@@ -7,6 +7,7 @@
#include "ash/ash_switches.h"
#include "ash/shelf/shelf.h"
#include "ash/shelf/shelf_layout_manager.h"
+#include "ash/shelf/shelf_view.h"
#include "ash/shelf/shelf_widget.h"
#include "grit/ash_resources.h"
#include "grit/ash_strings.h"
@@ -35,8 +36,8 @@ const int kBackgroundOffset = (48 - kButtonHoverSize) / 2;
} // namesapce
-OverflowButton::OverflowButton(views::ButtonListener* listener, Shelf* shelf)
- : CustomButton(listener), bottom_image_(nullptr), shelf_(shelf) {
+OverflowButton::OverflowButton(ShelfView* shelf_view)
+ : CustomButton(nullptr), bottom_image_(nullptr), shelf_view_(shelf_view) {
ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance();
bottom_image_ = rb->GetImageNamed(IDR_ASH_SHELF_OVERFLOW).ToImageSkia();
@@ -55,7 +56,7 @@ void OverflowButton::PaintBackground(gfx::Canvas* canvas, int alpha) {
gfx::Rect rect(0, 0, kButtonHoverSize, kButtonHoverSize);
// Nudge the background a little to line up right.
- if (shelf_->IsHorizontalAlignment()) {
+ if (shelf_view_->shelf()->IsHorizontalAlignment()) {
rect.set_origin(gfx::Point(
bounds.x() + ((bounds.width() - kButtonHoverSize) / 2) - 1,
bounds.y() + kBackgroundOffset - 1));
@@ -83,16 +84,16 @@ void OverflowButton::OnPaint(gfx::Canvas* canvas) {
gfx::Rect bounds(GetContentsBounds());
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
int background_image_id = 0;
- if (shelf_->IsShowingOverflowBubble())
+ if (shelf_view_->shelf()->IsShowingOverflowBubble())
background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_PRESSED;
- else if (shelf_->shelf_widget()->GetDimsShelf())
+ else if (shelf_view_->shelf()->shelf_widget()->GetDimsShelf())
background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_ON_BLACK;
else
background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_NORMAL;
const gfx::ImageSkia* background =
rb.GetImageNamed(background_image_id).ToImageSkia();
- ShelfAlignment alignment = shelf_->alignment();
+ ShelfAlignment alignment = shelf_view_->shelf()->alignment();
if (alignment == SHELF_ALIGNMENT_LEFT) {
bounds = gfx::Rect(
bounds.right() - background->width() -
@@ -142,4 +143,9 @@ void OverflowButton::OnPaint(gfx::Canvas* canvas) {
bounds.y() + ((bounds.height() - image->height()) / 2));
}
+void OverflowButton::NotifyClick(const ui::Event& event) {
+ CustomButton::NotifyClick(event);
+ shelf_view_->ButtonPressed(this, event, ink_drop());
+}
+
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698