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

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: Added tests 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 699a32c180769748988fb42e5ad81c659a4e2ae8..748873a72d85834146388c022ff03c2c0bfdb9b2 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"
@@ -58,7 +59,6 @@ extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT;
class ASH_EXPORT ShelfView : public views::View,
public ShelfModelObserver,
- public views::ButtonListener,
James Cook 2016/06/13 19:55:35 optional: You could also introduce an InkDropButto
mohsen 2016/06/14 06:24:38 Good idea. Done.
public views::ContextMenuController,
public views::FocusTraversable,
public views::BoundsAnimatorObserver,
@@ -138,6 +138,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 ShouldIgnoreEventOnButton(views::View* view, const ui::Event& event);
James Cook 2016/06/13 19:55:35 Consider inverting the boolean sense of this and c
mohsen 2016/06/14 06:24:38 Done.
+
// The shelf buttons use the Pointer interface to enable item reordering.
enum Pointer { NONE, DRAG_AND_DROP, MOUSE, TOUCH };
void PointerPressedOnButton(views::View* view,
@@ -150,6 +154,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
James Cook 2016/06/13 19:55:35 Are you actually planning to convert menus to be a
mohsen 2016/06/14 06:24:38 Yes, there is a plan to convert all menus to be as
+ // 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();
@@ -277,16 +292,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,
@@ -439,7 +453,7 @@ class ASH_EXPORT ShelfView : public views::View,
// True if the event is a repost event from a event which has just closed the
// menu of the same shelf item.
- bool is_repost_event_;
+ bool is_repost_event_on_same_item_;
// Record the index for the last pressed shelf item. This variable is used to
// check if a repost event occurs on the same shelf item as previous one. If

Powered by Google App Engine
This is Rietveld 408576698