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

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: Added tests 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 3602ae1fcf76deaad4fdf8df504482f4b4135549..fdc94a766e8c9a9369753d18328c7fda79dfc27c 100644
--- a/ash/shelf/overflow_button.cc
+++ b/ash/shelf/overflow_button.cc
@@ -9,6 +9,7 @@
#include "ash/common/shelf/shelf_constants.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"
@@ -26,8 +27,8 @@
namespace ash {
-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();
@@ -47,12 +48,17 @@ void OverflowButton::OnPaint(gfx::Canvas* canvas) {
PaintForeground(canvas, bounds);
}
+void OverflowButton::NotifyClick(const ui::Event& event) {
+ CustomButton::NotifyClick(event);
+ shelf_view_->ButtonPressed(this, event, ink_drop());
+}
+
void OverflowButton::PaintBackground(gfx::Canvas* canvas,
const gfx::Rect& bounds) {
if (MaterialDesignController::IsShelfMaterial()) {
SkColor color = SK_ColorTRANSPARENT;
- ShelfWidget* shelf_widget = shelf_->shelf_widget();
- if (shelf_->IsShowingOverflowBubble()) {
+ ShelfWidget* shelf_widget = shelf_view_->shelf()->shelf_widget();
+ if (shelf_view_->shelf()->IsShowingOverflowBubble()) {
// TODO(bruthig|mohsen): Use of this color is temporary. Draw the active
// state using the material design ripple animation.
color = SK_ColorBLUE;
@@ -82,7 +88,7 @@ void OverflowButton::PaintForeground(gfx::Canvas* canvas,
const gfx::Rect& bounds) {
const gfx::ImageSkia* image = nullptr;
- switch(shelf_->alignment()) {
+ switch (shelf_view_->shelf()->alignment()) {
case SHELF_ALIGNMENT_LEFT:
if (left_image_.isNull()) {
left_image_ = gfx::ImageSkiaOperations::CreateRotatedImage(
@@ -108,15 +114,15 @@ void OverflowButton::PaintForeground(gfx::Canvas* canvas,
}
int OverflowButton::NonMaterialBackgroundImageId() {
- if (shelf_->IsShowingOverflowBubble())
+ if (shelf_view_->shelf()->IsShowingOverflowBubble())
return IDR_AURA_NOTIFICATION_BACKGROUND_PRESSED;
- else if (shelf_->shelf_widget()->GetDimsShelf())
+ else if (shelf_view_->shelf()->shelf_widget()->GetDimsShelf())
return IDR_AURA_NOTIFICATION_BACKGROUND_ON_BLACK;
return IDR_AURA_NOTIFICATION_BACKGROUND_NORMAL;
}
gfx::Rect OverflowButton::CalculateButtonBounds() {
- ShelfAlignment alignment = shelf_->alignment();
+ ShelfAlignment alignment = shelf_view_->shelf()->alignment();
gfx::Rect bounds(GetContentsBounds());
if (!MaterialDesignController::IsShelfMaterial()) {
ResourceBundle& rb = ResourceBundle::GetSharedInstance();

Powered by Google App Engine
This is Rietveld 408576698