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

Unified Diff: ash/common/system/tray/actionable_view.cc

Issue 2499453002: Add ink drop ripple to overview mode button (Closed)
Patch Set: Fixed crash when there is no window Created 4 years, 1 month 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/common/system/tray/actionable_view.cc
diff --git a/ash/common/system/tray/actionable_view.cc b/ash/common/system/tray/actionable_view.cc
index 07be3c018ee83d232b94863122483498c9e338f0..e868b99884dc05ca7c319a5eb11ea5ec79fc9bd6 100644
--- a/ash/common/system/tray/actionable_view.cc
+++ b/ash/common/system/tray/actionable_view.cc
@@ -23,6 +23,8 @@ const char ActionableView::kViewClassName[] = "tray/ActionableView";
ActionableView::ActionableView(SystemTrayItem* owner)
: views::CustomButton(this), destroyed_(nullptr), owner_(owner) {
SetFocusBehavior(FocusBehavior::ALWAYS);
+ set_ink_drop_base_color(kTrayPopupInkDropBaseColor);
+ set_ink_drop_visible_opacity(kTrayPopupInkDropRippleOpacity);
set_has_ink_drop_action_on_click(false);
set_notify_enter_exit_on_child(true);
}
@@ -42,6 +44,13 @@ gfx::Rect ActionableView::GetFocusBounds() {
return GetLocalBounds();
}
+void ActionableView::HandlePerformActionResult(bool action_performed,
+ const ui::Event& event) {
+ AnimateInkDrop(action_performed ? views::InkDropState::ACTION_TRIGGERED
+ : views::InkDropState::HIDDEN,
+ ui::LocatedEvent::FromIfValid(&event));
+}
+
const char* ActionableView::GetClassName() const {
return kViewClassName;
}
@@ -92,7 +101,7 @@ std::unique_ptr<views::InkDropRipple> ActionableView::CreateInkDropRipple()
const {
return base::MakeUnique<views::FloodFillInkDropRipple>(
GetLocalBounds(), GetInkDropCenterBasedOnLastEvent(),
- kTrayPopupInkDropBaseColor, kTrayPopupInkDropRippleOpacity);
+ GetInkDropBaseColor(), ink_drop_visible_opacity());
}
std::unique_ptr<views::InkDropHighlight>
@@ -100,7 +109,7 @@ ActionableView::CreateInkDropHighlight() const {
std::unique_ptr<views::InkDropHighlight> highlight(
new views::InkDropHighlight(size(), 0,
gfx::RectF(GetLocalBounds()).CenterPoint(),
- kTrayPopupInkDropBaseColor));
+ GetInkDropBaseColor()));
highlight->set_visible_opacity(kTrayPopupInkDropHighlightOpacity);
return highlight;
}
@@ -118,13 +127,7 @@ void ActionableView::ButtonPressed(Button* sender, const ui::Event& event) {
return;
destroyed_ = nullptr;
- if (action_performed) {
- AnimateInkDrop(views::InkDropState::ACTION_TRIGGERED,
- ui::LocatedEvent::FromIfValid(&event));
- } else {
- AnimateInkDrop(views::InkDropState::HIDDEN,
- ui::LocatedEvent::FromIfValid(&event));
- }
+ HandlePerformActionResult(action_performed, event);
}
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698