OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef ASH_COMMON_SHELF_SHELF_ITEM_DELEGATE_H_ | |
6 #define ASH_COMMON_SHELF_SHELF_ITEM_DELEGATE_H_ | |
7 | |
8 #include <stdint.h> | |
9 | |
10 #include "ash/ash_export.h" | |
11 #include "ash/public/cpp/shelf_application_menu_item.h" | |
12 #include "ash/public/cpp/shelf_types.h" | |
13 #include "ui/events/event_constants.h" | |
14 | |
15 namespace ash { | |
16 | |
17 // Delegate for the ShelfItem. | |
18 class ASH_EXPORT ShelfItemDelegate { | |
19 public: | |
20 ShelfItemDelegate(); | |
21 virtual ~ShelfItemDelegate(); | |
22 | |
23 // Called when the user selects a shelf item. The event type and flags, the | |
24 // relevant display id, and the source of the selection should be provided if | |
25 // they are known to the caller; as some subclasses use these arguments. | |
26 // Defaults: (ET_UNKNOWN, EF_NONE, kInvalidDisplayId, LAUNCH_FROM_UNKNOWN) | |
27 // Returns the action performed by selecting the item. | |
28 virtual ShelfAction ItemSelected(ui::EventType event_type, | |
29 int event_flags, | |
30 int64_t display_id, | |
31 ShelfLaunchSource source) = 0; | |
32 | |
33 // A helper to call ItemSelected with a source and default arguments. | |
34 ShelfAction ItemSelectedBySource(ShelfLaunchSource source); | |
35 | |
36 // Returns any application menu items that should appear for this shelf item. | |
37 // |event_flags| specifies the flags of the event which triggered this menu. | |
38 virtual ShelfAppMenuItemList GetAppMenuItems(int event_flags) = 0; | |
39 | |
40 // Called on invocation of a shelf item's application menu command. | |
41 virtual void ExecuteCommand(uint32_t command_id, int event_flags) = 0; | |
42 | |
43 // Closes all windows associated with this item. | |
44 virtual void Close() = 0; | |
45 | |
46 DISALLOW_COPY_AND_ASSIGN(ShelfItemDelegate); | |
47 }; | |
48 | |
49 } // namespace ash | |
50 | |
51 #endif // ASH_COMMON_SHELF_SHELF_ITEM_DELEGATE_H_ | |
OLD | NEW |