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

Unified Diff: ash/common/shelf/shelf_item_delegate.h

Issue 2696073002: Merge ShelfItemDelegate::ItemSelected & LauncherItemDelegate::Activate. (Closed)
Patch Set: nit Created 3 years, 10 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
« no previous file with comments | « ash/common/shelf/shelf_controller.cc ('k') | ash/common/shelf/shelf_item_delegate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/shelf/shelf_item_delegate.h
diff --git a/ash/common/shelf/shelf_item_delegate.h b/ash/common/shelf/shelf_item_delegate.h
index 43605db24411b7426b6bafa0293ccc6141350283..ce7dd17c3e6549e8a99eef6e98c731ff5d537592 100644
--- a/ash/common/shelf/shelf_item_delegate.h
+++ b/ash/common/shelf/shelf_item_delegate.h
@@ -7,40 +7,29 @@
#include "ash/ash_export.h"
#include "ash/public/cpp/shelf_application_menu_item.h"
-
-namespace ui {
-class Event;
-}
+#include "ash/public/cpp/shelf_types.h"
+#include "ui/events/event_constants.h"
namespace ash {
// Delegate for the ShelfItem.
class ASH_EXPORT ShelfItemDelegate {
public:
- // The return type for the ShelfItemDelegate::ItemSelected method.
- enum PerformedAction {
- // No action was taken.
- kNoAction,
- // A new window was created.
- kNewWindowCreated,
- // An existing window which was not currently active was activated.
- kExistingWindowActivated,
- // The currently active window was minimized.
- kExistingWindowMinimized,
- // The app list launcher menu was shown.
- kAppListMenuShown,
- };
-
- virtual ~ShelfItemDelegate() {}
-
- // Invoked when the user clicks on a window entry in the launcher.
- // |event| is the click event. The |event| is dispatched by a view
- // and has an instance of |views::View| as the event target
- // but not |aura::Window|. If the |event| is of type KeyEvent, it is assumed
- // that this was triggered by keyboard action (Alt+<number>) and special
- // handling might happen.
+ ShelfItemDelegate();
+ virtual ~ShelfItemDelegate();
+
+ // Called when the user selects a shelf item. The event type and flags, the
+ // relevant display id, and the source of the selection should be provided if
+ // they are known to the caller; as some subclasses use these arguments.
+ // Defaults: (ET_UNKNOWN, EF_NONE, kInvalidDisplayId, LAUNCH_FROM_UNKNOWN)
// Returns the action performed by selecting the item.
- virtual PerformedAction ItemSelected(const ui::Event& event) = 0;
+ virtual ShelfAction ItemSelected(ui::EventType event_type,
+ int event_flags,
+ int64_t display_id,
+ ShelfLaunchSource source) = 0;
+
+ // A helper to call ItemSelected with a source and default arguments.
+ ShelfAction ItemSelectedBySource(ShelfLaunchSource source);
// Returns any application menu items that should appear for this shelf item.
// |event_flags| specifies the flags of the event which triggered this menu.
@@ -48,6 +37,8 @@ class ASH_EXPORT ShelfItemDelegate {
// Closes all windows associated with this item.
virtual void Close() = 0;
+
+ DISALLOW_COPY_AND_ASSIGN(ShelfItemDelegate);
};
} // namespace ash
« no previous file with comments | « ash/common/shelf/shelf_controller.cc ('k') | ash/common/shelf/shelf_item_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698