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. | |
21 enum PerformedAction { | |
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 | |
34 virtual ~ShelfItemDelegate() {} | 18 virtual ~ShelfItemDelegate() {} |
35 | 19 |
36 // Invoked when the user clicks on a window entry in the launcher. | 20 // Called when the user selects a shelf item. The event type and flags, the |
37 // |event| is the click event. The |event| is dispatched by a view | 21 // relevant display id, and the source of the selection are sometimes known. |
James Cook
2017/02/15 00:44:39
uh, "sometimes known"? Maybe tell the reader which
msw
2017/02/15 19:59:17
Heh, I didn't want to enumerate the various codepa
| |
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. | 22 // Returns the action performed by selecting the item. |
43 virtual PerformedAction ItemSelected(const ui::Event& event) = 0; | 23 // TODO(msw): Replace ui::EventType with ui::mojom::EventType. |
24 virtual ShelfAction ItemSelected(ui::EventType event_type, | |
25 int event_flags, | |
26 int64_t display_id, | |
James Cook
2017/02/15 00:44:39
You could also provide two versions, one of which
msw
2017/02/15 19:59:17
I'd rather not overload this function; I'm hoping
| |
27 ShelfLaunchSource source) = 0; | |
44 | 28 |
45 // Returns any application menu items that should appear for this shelf item. | 29 // 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. | 30 // |event_flags| specifies the flags of the event which triggered this menu. |
47 virtual ShelfAppMenuItemList GetAppMenuItems(int event_flags) = 0; | 31 virtual ShelfAppMenuItemList GetAppMenuItems(int event_flags) = 0; |
48 | 32 |
49 // Closes all windows associated with this item. | 33 // Closes all windows associated with this item. |
50 virtual void Close() = 0; | 34 virtual void Close() = 0; |
51 }; | 35 }; |
52 | 36 |
53 } // namespace ash | 37 } // namespace ash |
54 | 38 |
55 #endif // ASH_COMMON_SHELF_SHELF_ITEM_DELEGATE_H_ | 39 #endif // ASH_COMMON_SHELF_SHELF_ITEM_DELEGATE_H_ |
OLD | NEW |