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 6a8585750c7b971d02bd366fab49fbebf2915ea9..94163101ab63562add7ea379e2d78e1e61c29e31 100644 |
| --- a/ash/common/shelf/overflow_button.cc |
| +++ b/ash/common/shelf/overflow_button.cc |
| @@ -23,6 +23,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 { |
| @@ -33,6 +34,9 @@ OverflowButton::OverflowButton(InkDropButtonListener* listener, |
| listener_(listener), |
| wm_shelf_(wm_shelf) { |
| if (MaterialDesignController::IsShelfMaterial()) { |
| + SetInkDropMode(InkDropMode::ON); |
| + set_ink_drop_base_color(kShelfInkDropBaseColor); |
| + set_ink_drop_visible_opacity(kShelfInkDropVisibleOpacity); |
| bottom_image_md_ = |
| CreateVectorIcon(gfx::VectorIconId::SHELF_OVERFLOW, kShelfIconColor); |
| bottom_image_ = &bottom_image_md_; |
| @@ -51,12 +55,43 @@ void OverflowButton::OnShelfAlignmentChanged() { |
| SchedulePaint(); |
| } |
| +void OverflowButton::OnOverflowBubbleShown() { |
| + AnimateInkDrop(views::InkDropState::ACTIVATED, nullptr); |
| + // While overflow bubble is active, showing context menu should not hide ink |
| + // drop. |
| + set_hide_ink_drop_when_showing_context_menu(false); |
|
bruthig
2016/07/26 13:57:15
Does this need to be toggled or can it just be ini
mohsen
2016/07/26 20:00:58
My OverflowButton::ShouldEnterPushedState() was wr
|
| + if (!ash::MaterialDesignController::IsShelfMaterial()) |
| + SchedulePaint(); |
| +} |
| + |
| +void OverflowButton::OnOverflowBubbleHidden() { |
| + AnimateInkDrop(views::InkDropState::DEACTIVATED, nullptr); |
| + set_hide_ink_drop_when_showing_context_menu(true); |
| + if (!ash::MaterialDesignController::IsShelfMaterial()) |
| + SchedulePaint(); |
| +} |
| + |
| void OverflowButton::OnPaint(gfx::Canvas* canvas) { |
| gfx::Rect bounds = CalculateButtonBounds(); |
| PaintBackground(canvas, bounds); |
| PaintForeground(canvas, bounds); |
| } |
| +std::unique_ptr<views::InkDropRipple> OverflowButton::CreateInkDropRipple() |
| + const { |
| + return base::WrapUnique(new views::FloodFillInkDropRipple( |
| + CalculateButtonBounds(), GetInkDropCenterBasedOnLastEvent(), |
| + GetInkDropBaseColor(), ink_drop_visible_opacity())); |
| +} |
| + |
| +bool OverflowButton::ShouldEnterPushedState(const ui::Event& event) { |
| + return !wm_shelf_->IsShowingOverflowBubble(); |
| +} |
| + |
| +bool OverflowButton::ShouldShowInkDropHighlight() const { |
| + return false; |
| +} |
| + |
| void OverflowButton::NotifyClick(const ui::Event& event) { |
| CustomButton::NotifyClick(event); |
| if (listener_) |
| @@ -80,14 +115,6 @@ void OverflowButton::PaintBackground(gfx::Canvas* canvas, |
| background_paint.setColor(background_color); |
| canvas->DrawRoundRect(bounds, kOverflowButtonCornerRadius, |
| background_paint); |
| - |
| - if (wm_shelf_->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 = |
| @@ -125,7 +152,7 @@ void OverflowButton::PaintForeground(gfx::Canvas* canvas, |
| bounds.y() + ((bounds.height() - image->height()) / 2)); |
| } |
| -int OverflowButton::NonMaterialBackgroundImageId() { |
| +int OverflowButton::NonMaterialBackgroundImageId() const { |
| if (wm_shelf_->IsShowingOverflowBubble()) |
| return IDR_AURA_NOTIFICATION_BACKGROUND_PRESSED; |
| else if (wm_shelf_->IsDimmed()) |
| @@ -133,7 +160,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(); |