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

Unified Diff: ui/views/animation/toolbar_ink_drop_delegate.h

Issue 1411833006: Refactoring to make adding ink drop animations easier (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Attempt to refactor ink drop animations (wired up chained EventHandler) 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
Index: ui/views/animation/toolbar_ink_drop_delegate.h
diff --git a/ui/views/animation/toolbar_ink_drop_delegate.h b/ui/views/animation/toolbar_ink_drop_delegate.h
new file mode 100644
index 0000000000000000000000000000000000000000..75d43bb81961dc40e0bd345d4bae0461f447aa7e
--- /dev/null
+++ b/ui/views/animation/toolbar_ink_drop_delegate.h
@@ -0,0 +1,67 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_VIEWS_ANIMATION_TOOLBAR_INK_DROP_DELEGATE_H_
+#define UI_VIEWS_ANIMATION_TOOLBAR_INK_DROP_DELEGATE_H_
+
+#include "base/macros.h"
+#include "ui/events/event_handler.h"
+#include "ui/views/animation/ink_drop_delegate.h"
+#include "ui/views/views_export.h"
+
+namespace views {
+
+class InkDropAnimationController;
+class InkDropHost;
+class View;
+
+// An InkDropDelegate that handles animations for toolbar buttons.
+class VIEWS_EXPORT ToolbarInkDropDelegate : public InkDropDelegate,
+ public ui::EventHandler {
+ public:
+ ToolbarInkDropDelegate(InkDropHost* ink_drop_host,
+ View* view);
+ ~ToolbarInkDropDelegate() override;
+
+ // InkDropDelegate:
+ void SetInkDropSize(int large_size,
+ int large_corner_radius,
+ int small_size,
+ int small_corner_radius) override;
+ void OnLayout() override;
+ void OnActionComplete() override;
+ void OnActionPending() override;
+ void OnActionQuick() override;
+ void OnActivated() override;
+ void OnDeactivated() override;
+
+ // ui::EventHandler:
+ void OnEvent(ui::Event* event) override;
+ void OnKeyEvent(ui::KeyEvent* event) override;
+ void OnMouseEvent(ui::MouseEvent* event) override;
+ void OnScrollEvent(ui::ScrollEvent* event) override;
+ void OnTouchEvent(ui::TouchEvent* event) override;
+ void OnGestureEvent(ui::GestureEvent* event) override;
+ void OnCancelMode(ui::CancelModeEvent* event) override;
+
+ private:
+ // View that allows this class to handle events before or after
+ // |view_| gets a chance to handle them.
+ View* view_;
bruthig 2015/11/16 22:37:11 Do we actually need to interface with View specifi
varkha 2015/11/18 22:56:44 Done.
+
+ // Pass events to |original_event_handler_| if it was set.
+ ui::EventHandler* original_event_handler_;
+
+ // Parent InkDropHost (typically a View) that hosts the ink ripple animations.
+ InkDropHost* ink_drop_host_;
+
+ // Animation controller for the ink drop ripple effect.
+ scoped_ptr<InkDropAnimationController> ink_drop_animation_controller_;
+
+ DISALLOW_COPY_AND_ASSIGN(ToolbarInkDropDelegate);
+};
+
+} // namespace views
+
+#endif // UI_VIEWS_ANIMATION_TOOLBAR_INK_DROP_DELEGATE_H_

Powered by Google App Engine
This is Rietveld 408576698