Chromium Code Reviews| Index: ash/common/shelf/overflow_button.cc |
| diff --git a/ash/common/shelf/overflow_button.cc b/ash/common/shelf/overflow_button.cc |
| index 14120152315f03fb5299b40015d105d6b375d437..f277fb21df5b4a23f50d3f5c08732d7116c82109 100644 |
| --- a/ash/common/shelf/overflow_button.cc |
| +++ b/ash/common/shelf/overflow_button.cc |
| @@ -24,6 +24,7 @@ |
| #include "ui/gfx/skia_util.h" |
| #include "ui/gfx/transform.h" |
| #include "ui/gfx/vector_icons_public.h" |
| +#include "ui/views/animation/flood_fill_ink_drop_ripple.h" |
| namespace ash { |
| @@ -35,6 +36,10 @@ OverflowButton::OverflowButton(ShelfView* shelf_view, WmShelf* wm_shelf) |
| background_alpha_(0) { |
| DCHECK(shelf_view_); |
| if (MaterialDesignController::IsShelfMaterial()) { |
| + SetInkDropMode(InkDropMode::ON); |
| + set_ink_drop_base_color(kShelfInkDropBaseColor); |
| + set_ink_drop_visible_opacity(kShelfInkDropVisibleOpacity); |
| + set_hide_ink_drop_when_showing_context_menu(false); |
| bottom_image_md_ = |
| CreateVectorIcon(gfx::VectorIconId::SHELF_OVERFLOW, kShelfIconColor); |
| bottom_image_ = &bottom_image_md_; |
| @@ -53,6 +58,18 @@ void OverflowButton::OnShelfAlignmentChanged() { |
| SchedulePaint(); |
| } |
| +void OverflowButton::OnOverflowBubbleShown() { |
| + AnimateInkDrop(views::InkDropState::ACTIVATED, nullptr); |
| + if (!ash::MaterialDesignController::IsShelfMaterial()) |
| + SchedulePaint(); |
| +} |
| + |
| +void OverflowButton::OnOverflowBubbleHidden() { |
| + AnimateInkDrop(views::InkDropState::DEACTIVATED, nullptr); |
| + if (!ash::MaterialDesignController::IsShelfMaterial()) |
| + SchedulePaint(); |
| +} |
| + |
| void OverflowButton::SetBackgroundAlpha(int alpha) { |
| background_alpha_ = alpha; |
| SchedulePaint(); |
| @@ -64,6 +81,24 @@ void OverflowButton::OnPaint(gfx::Canvas* canvas) { |
| PaintForeground(canvas, bounds); |
| } |
| +std::unique_ptr<views::InkDropRipple> OverflowButton::CreateInkDropRipple() |
| + const { |
| + return base::WrapUnique(new views::FloodFillInkDropRipple( |
|
James Cook
2016/09/12 02:54:47
nit: IWYU #include ptr_util.h
mohsen
2016/09/14 18:34:42
Done. Also, replaced with base::MakeUnique().
|
| + CalculateButtonBounds(), GetInkDropCenterBasedOnLastEvent(), |
| + GetInkDropBaseColor(), ink_drop_visible_opacity())); |
| +} |
| + |
| +bool OverflowButton::ShouldEnterPushedState(const ui::Event& event) { |
| + if (shelf_view_->IsShowingOverflowBubble()) |
| + return false; |
| + |
| + return CustomButton::ShouldEnterPushedState(event); |
| +} |
| + |
| +bool OverflowButton::ShouldShowInkDropHighlight() const { |
| + return false; |
| +} |
| + |
| void OverflowButton::NotifyClick(const ui::Event& event) { |
| CustomButton::NotifyClick(event); |
| shelf_view_->ButtonPressed(this, event, ink_drop()); |
| @@ -77,14 +112,6 @@ void OverflowButton::PaintBackground(gfx::Canvas* canvas, |
| background_paint.setColor(SkColorSetA(kShelfBaseColor, background_alpha_)); |
| canvas->DrawRoundRect(bounds, kOverflowButtonCornerRadius, |
| background_paint); |
| - |
| - if (shelf_view_->IsShowingOverflowBubble()) { |
| - SkPaint highlight_paint; |
| - highlight_paint.setFlags(SkPaint::kAntiAlias_Flag); |
| - highlight_paint.setColor(kShelfButtonActivatedHighlightColor); |
| - canvas->DrawRoundRect(bounds, kOverflowButtonCornerRadius, |
| - highlight_paint); |
| - } |
| } else { |
| ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| const gfx::ImageSkia* background = |
| @@ -122,7 +149,7 @@ void OverflowButton::PaintForeground(gfx::Canvas* canvas, |
| bounds.y() + ((bounds.height() - image->height()) / 2)); |
| } |
| -int OverflowButton::NonMaterialBackgroundImageId() { |
| +int OverflowButton::NonMaterialBackgroundImageId() const { |
| if (shelf_view_->IsShowingOverflowBubble()) |
| return IDR_AURA_NOTIFICATION_BACKGROUND_PRESSED; |
| else if (wm_shelf_->IsDimmed()) |
| @@ -130,7 +157,7 @@ int OverflowButton::NonMaterialBackgroundImageId() { |
| return IDR_AURA_NOTIFICATION_BACKGROUND_NORMAL; |
| } |
| -gfx::Rect OverflowButton::CalculateButtonBounds() { |
| +gfx::Rect OverflowButton::CalculateButtonBounds() const { |
| ShelfAlignment alignment = wm_shelf_->GetAlignment(); |
| gfx::Rect bounds(GetContentsBounds()); |
| ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |