Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ASH_COMMON_SHELF_SHELF_ITEM_DELEGATE_H_ | 5 #ifndef ASH_COMMON_SHELF_SHELF_ITEM_DELEGATE_H_ |
| 6 #define ASH_COMMON_SHELF_SHELF_ITEM_DELEGATE_H_ | 6 #define ASH_COMMON_SHELF_SHELF_ITEM_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "ash/public/cpp/shelf_application_menu_item.h" | 9 #include "ash/public/cpp/shelf_application_menu_item.h" |
| 10 | 10 #include "ash/public/cpp/shelf_types.h" |
| 11 namespace ui { | 11 #include "ui/events/event_constants.h" |
| 12 class Event; | |
| 13 } | |
| 14 | 12 |
| 15 namespace ash { | 13 namespace ash { |
| 16 | 14 |
| 17 // Delegate for the ShelfItem. | 15 // Delegate for the ShelfItem. |
| 18 class ASH_EXPORT ShelfItemDelegate { | 16 class ASH_EXPORT ShelfItemDelegate { |
| 19 public: | 17 public: |
| 20 // The return type for the ShelfItemDelegate::ItemSelected method. | 18 ShelfItemDelegate(); |
| 21 enum PerformedAction { | 19 virtual ~ShelfItemDelegate(); |
| 22 // No action was taken. | |
| 23 kNoAction, | |
| 24 // A new window was created. | |
| 25 kNewWindowCreated, | |
| 26 // An existing window which was not currently active was activated. | |
| 27 kExistingWindowActivated, | |
| 28 // The currently active window was minimized. | |
| 29 kExistingWindowMinimized, | |
| 30 // The app list launcher menu was shown. | |
| 31 kAppListMenuShown, | |
| 32 }; | |
| 33 | 20 |
| 34 virtual ~ShelfItemDelegate() {} | 21 // Called when the user selects a shelf item. The event type and flags, the |
| 35 | 22 // relevant display id, and the source of the selection should be provided if |
| 36 // Invoked when the user clicks on a window entry in the launcher. | 23 // they are known to the caller; as some subclasses use these arguments. |
| 37 // |event| is the click event. The |event| is dispatched by a view | 24 // Defaults: (ET_UNKNOWN, EF_NONE, kInvalidDisplayId, LAUNCH_FROM_UNKNOWN) |
| 38 // and has an instance of |views::View| as the event target | |
| 39 // but not |aura::Window|. If the |event| is of type KeyEvent, it is assumed | |
| 40 // that this was triggered by keyboard action (Alt+<number>) and special | |
| 41 // handling might happen. | |
| 42 // Returns the action performed by selecting the item. | 25 // Returns the action performed by selecting the item. |
| 43 virtual PerformedAction ItemSelected(const ui::Event& event) = 0; | 26 ShelfAction ItemSelectedBySource(ShelfLaunchSource source); |
|
James Cook
2017/02/16 00:08:18
nit: I would put this above the comment, or below
msw
2017/02/16 00:12:20
Done.
| |
| 27 virtual ShelfAction ItemSelected(ui::EventType event_type, | |
| 28 int event_flags, | |
| 29 int64_t display_id, | |
| 30 ShelfLaunchSource source) = 0; | |
| 44 | 31 |
| 45 // Returns any application menu items that should appear for this shelf item. | 32 // Returns any application menu items that should appear for this shelf item. |
| 46 // |event_flags| specifies the flags of the event which triggered this menu. | 33 // |event_flags| specifies the flags of the event which triggered this menu. |
| 47 virtual ShelfAppMenuItemList GetAppMenuItems(int event_flags) = 0; | 34 virtual ShelfAppMenuItemList GetAppMenuItems(int event_flags) = 0; |
| 48 | 35 |
| 49 // Closes all windows associated with this item. | 36 // Closes all windows associated with this item. |
| 50 virtual void Close() = 0; | 37 virtual void Close() = 0; |
| 38 | |
| 39 DISALLOW_COPY_AND_ASSIGN(ShelfItemDelegate); | |
| 51 }; | 40 }; |
| 52 | 41 |
| 53 } // namespace ash | 42 } // namespace ash |
| 54 | 43 |
| 55 #endif // ASH_COMMON_SHELF_SHELF_ITEM_DELEGATE_H_ | 44 #endif // ASH_COMMON_SHELF_SHELF_ITEM_DELEGATE_H_ |
| OLD | NEW |