| 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_SHELF_SHELF_ITEM_DELEGATE_H_ | |
| 6 #define ASH_SHELF_SHELF_ITEM_DELEGATE_H_ | |
| 7 | |
| 8 #include "ash/ash_export.h" | |
| 9 #include "base/strings/string16.h" | |
| 10 | |
| 11 namespace ui { | |
| 12 class Event; | |
| 13 class MenuModel; | |
| 14 } | |
| 15 | |
| 16 namespace ash { | |
| 17 | |
| 18 class ShelfMenuModel; | |
| 19 | |
| 20 // Delegate for the ShelfItem. | |
| 21 class ASH_EXPORT ShelfItemDelegate { | |
| 22 public: | |
| 23 // The return type for the ShelfItemDelegate::ItemSelected method. | |
| 24 enum PerformedAction { | |
| 25 // No action was taken. | |
| 26 kNoAction, | |
| 27 // A new window was created. | |
| 28 kNewWindowCreated, | |
| 29 // An existing window which was not currently active was activated. | |
| 30 kExistingWindowActivated, | |
| 31 // The currently active window was minimized. | |
| 32 kExistingWindowMinimized, | |
| 33 // The app list launcher menu was shown. | |
| 34 kAppListMenuShown, | |
| 35 }; | |
| 36 | |
| 37 virtual ~ShelfItemDelegate() {} | |
| 38 | |
| 39 // Invoked when the user clicks on a window entry in the launcher. | |
| 40 // |event| is the click event. The |event| is dispatched by a view | |
| 41 // and has an instance of |views::View| as the event target | |
| 42 // but not |aura::Window|. If the |event| is of type KeyEvent, it is assumed | |
| 43 // that this was triggered by keyboard action (Alt+<number>) and special | |
| 44 // handling might happen. | |
| 45 // Returns the action performed by selecting the item. | |
| 46 virtual PerformedAction ItemSelected(const ui::Event& event) = 0; | |
| 47 | |
| 48 // Returns the title to display. | |
| 49 virtual base::string16 GetTitle() = 0; | |
| 50 | |
| 51 // Returns whether the user can change the pin status of this item. | |
| 52 // Pinning may be disallowed by policy if this app is pinned by pre-defined | |
| 53 // pinned app list. | |
| 54 virtual bool CanPin() const = 0; | |
| 55 | |
| 56 // Returns the application menu model for the specified item. There are three | |
| 57 // possible return values: | |
| 58 // - A return of NULL indicates that no menu is wanted for this item. | |
| 59 // - A return of a menu with one item means that only the name of the | |
| 60 // application/item was added and there are no active applications. | |
| 61 // Note: This is useful for hover menus which also show context help. | |
| 62 // - A list containing the title and the active list of items. | |
| 63 // The caller takes ownership of the returned model. | |
| 64 // |event_flags| specifies the flags of the event which triggered this menu. | |
| 65 virtual ShelfMenuModel* CreateApplicationMenu(int event_flags) = 0; | |
| 66 | |
| 67 // Whether the launcher item is draggable. | |
| 68 virtual bool IsDraggable() = 0; | |
| 69 | |
| 70 // Returns true if a tooltip should be shown. | |
| 71 virtual bool ShouldShowTooltip() = 0; | |
| 72 | |
| 73 // Closes all windows associated with this item. | |
| 74 virtual void Close() = 0; | |
| 75 | |
| 76 }; | |
| 77 | |
| 78 } // namespace ash | |
| 79 | |
| 80 #endif // ASH_SHELF_SHELF_ITEM_DELEGATE_H_ | |
| OLD | NEW |