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

Unified Diff: ui/views/controls/button/custom_button.cc

Issue 1411833006: Refactoring to make adding ink drop animations easier (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactor ink drop animations (comments in ui/views/) Created 5 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
« no previous file with comments | « ui/views/controls/button/custom_button.h ('k') | ui/views/controls/button/menu_button.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/button/custom_button.cc
diff --git a/ui/views/controls/button/custom_button.cc b/ui/views/controls/button/custom_button.cc
index aafbf2d65a63aa32810d6da8d352f9bf1663f8af..c3d484773946c37005bd2fa00d68f4aa995591c5 100644
--- a/ui/views/controls/button/custom_button.cc
+++ b/ui/views/controls/button/custom_button.cc
@@ -10,6 +10,7 @@
#include "ui/events/keycodes/keyboard_codes.h"
#include "ui/gfx/animation/throb_animation.h"
#include "ui/gfx/screen.h"
+#include "ui/views/animation/ink_drop_delegate.h"
#include "ui/views/controls/button/blue_button.h"
#include "ui/views/controls/button/checkbox.h"
#include "ui/views/controls/button/image_button.h"
@@ -284,6 +285,8 @@ void CustomButton::OnDragDone() {
// (since disabled buttons may still be able to be dragged).
if (state_ != STATE_DISABLED)
SetState(STATE_NORMAL);
+ if (ink_drop_delegate_)
+ ink_drop_delegate_->OnAction(InkDropState::HIDDEN);
}
void CustomButton::GetAccessibleState(ui::AXViewState* state) {
@@ -371,9 +374,18 @@ bool CustomButton::ShouldEnterHoveredState() {
return check_mouse_position && IsMouseHovered();
}
+void CustomButton::set_ink_drop_delegate(InkDropDelegate* ink_drop_delegate) {
+ ink_drop_delegate_.reset(ink_drop_delegate);
+}
+
////////////////////////////////////////////////////////////////////////////////
// CustomButton, View overrides (protected):
+void CustomButton::OnBoundsChanged(const gfx::Rect& previous_bounds) {
+ if (ink_drop_delegate_)
bruthig 2015/11/26 21:27:33 Correct me if I'm wrong but the intent here was to
varkha 2015/11/26 22:12:40 I have restored override of Layout(). Can you see
+ ink_drop_delegate_->OnBoundsChanged();
+}
+
void CustomButton::ViewHierarchyChanged(
const ViewHierarchyChangedDetails& details) {
if (!details.is_add && state_ != STATE_DISABLED)
« no previous file with comments | « ui/views/controls/button/custom_button.h ('k') | ui/views/controls/button/menu_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698