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

Unified Diff: ash/shelf/shelf_view.h

Issue 2033553003: Add MD ink drop ripple to shelf app items (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased (after r398375) Created 4 years, 6 months 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/shelf/shelf_view.h
diff --git a/ash/shelf/shelf_view.h b/ash/shelf/shelf_view.h
index c9a525e9e95237fa0ded421490f5271af90fbe18..ed1264e010fc0ce43ff75cd3811b4816b695c240 100644
--- a/ash/shelf/shelf_view.h
+++ b/ash/shelf/shelf_view.h
@@ -19,6 +19,7 @@
#include "base/observer_list.h"
#include "ui/app_list/views/app_list_drag_and_drop_host.h"
#include "ui/views/animation/bounds_animator_observer.h"
+#include "ui/views/animation/ink_drop_state.h"
#include "ui/views/context_menu_controller.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/focus/focus_manager.h"
@@ -57,7 +58,6 @@ extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT;
class ASH_EXPORT ShelfView : public views::View,
public ShelfModelObserver,
- public views::ButtonListener,
public views::ContextMenuController,
public views::FocusTraversable,
public views::BoundsAnimatorObserver,
@@ -134,6 +134,10 @@ class ASH_EXPORT ShelfView : public views::View,
bool Drag(const gfx::Point& location_in_screen_coordinates) override;
void EndDrag(bool cancel) override;
+ // Returns true if the event on the shelf item is not going to activate the
+ // item. Used to determine whether a pending ink drop should be shown or not.
+ bool WillIgnoreEventOnButton(views::View* view, const ui::Event& event);
+
// The shelf buttons use the Pointer interface to enable item reordering.
enum Pointer { NONE, DRAG_AND_DROP, MOUSE, TOUCH };
void PointerPressedOnButton(views::View* view,
@@ -146,6 +150,17 @@ class ASH_EXPORT ShelfView : public views::View,
Pointer pointer,
bool canceled);
+ // TODO(mohsen): |ink_drop| is used to do appropriate ink drop animation based
+ // on the action performed. A better approach would be to return a value
+ // indicating the type of action performed such that the button can animate
+ // the ink drop. Currently it is not possible because showing menu is
+ // synchronous and blocks the call. Fix this after menu is converted to
+ // asynchronous. Long-term, the return value can be merged into
+ // ButtonListener.
+ void ButtonPressed(views::Button* sender,
+ const ui::Event& event,
+ views::InkDrop* ink_drop);
+
// Return the view model for test purposes.
const views::ViewModel* view_model_for_test() const {
return view_model_.get();
@@ -256,6 +271,12 @@ class ASH_EXPORT ShelfView : public views::View,
// Updates the visible range of overflow items in |overflow_view|.
void UpdateOverflowRange(ShelfView* overflow_view) const;
+ // Helper function handling button press. Returns whether an action was
+ // performed or not.
+ bool ButtonPressedImpl(views::Button* sender,
+ const ui::Event& event,
+ views::InkDrop* ink_drop);
+
// Overridden from views::View:
gfx::Size GetPreferredSize() const override;
void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
@@ -273,16 +294,15 @@ class ASH_EXPORT ShelfView : public views::View,
void ShelfItemChanged(int model_index, const ShelfItem& old_item) override;
void ShelfItemMoved(int start_index, int target_index) override;
- // Overridden from views::ButtonListener:
- void ButtonPressed(views::Button* sender, const ui::Event& event) override;
-
// Show a list of all running items for this shelf |item|; it only shows a
// menu if there are multiple running items. |source| specifies the view
// responsible for showing the menu, and the bubble will point towards it.
// The |event_flags| are the flags of the event which triggered this menu.
- void ShowListMenuForView(const ShelfItem& item,
+ // Returns |true| if a menu is shown.
+ bool ShowListMenuForView(const ShelfItem& item,
views::View* source,
- const ui::Event& event);
+ const ui::Event& event,
+ views::InkDrop* ink_drop);
// Overridden from views::ContextMenuController:
void ShowContextMenuForView(views::View* source,

Powered by Google App Engine
This is Rietveld 408576698