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.
5 #ifndef ASH_SHELF_SHELF_ITEM_DELEGATE_H_
6 #define ASH_SHELF_SHELF_ITEM_DELEGATE_H_
8 #include "ash/ash_export.h"
9 #include "base/strings/string16.h"
24 // Delegate for the ShelfItem.
25 class ASH_EXPORT ShelfItemDelegate
{
27 // The return type for the ShelfItemDelegate::ItemSelected method.
28 enum PerformedAction
{
29 // No action was taken.
31 // A new window was created.
33 // An existing window which was not currently active was activated.
34 kExistingWindowActivated
,
35 // The currently active window was minimized.
36 kExistingWindowMinimized
,
37 // The app list launcher menu was shown.
41 virtual ~ShelfItemDelegate() {}
43 // Invoked when the user clicks on a window entry in the launcher.
44 // |event| is the click event. The |event| is dispatched by a view
45 // and has an instance of |views::View| as the event target
46 // but not |aura::Window|. If the |event| is of type KeyEvent, it is assumed
47 // that this was triggered by keyboard action (Alt+<number>) and special
48 // handling might happen.
49 // Returns the action performed by selecting the item.
50 virtual PerformedAction
ItemSelected(const ui::Event
& event
) = 0;
52 // Returns the title to display.
53 virtual base::string16
GetTitle() = 0;
55 // Returns the context menumodel for the specified item on
56 // |root_window|. Return NULL if there should be no context
57 // menu. The caller takes ownership of the returned model.
58 virtual ui::MenuModel
* CreateContextMenu(aura::Window
* root_window
) = 0;
60 // Returns the application menu model for the specified item. There are three
61 // possible return values:
62 // - A return of NULL indicates that no menu is wanted for this item.
63 // - A return of a menu with one item means that only the name of the
64 // application/item was added and there are no active applications.
65 // Note: This is useful for hover menus which also show context help.
66 // - A list containing the title and the active list of items.
67 // The caller takes ownership of the returned model.
68 // |event_flags| specifies the flags of the event which triggered this menu.
69 virtual ShelfMenuModel
* CreateApplicationMenu(int event_flags
) = 0;
71 // Whether the launcher item is draggable.
72 virtual bool IsDraggable() = 0;
74 // Returns true if a tooltip should be shown.
75 virtual bool ShouldShowTooltip() = 0;
77 // Closes all windows associated with this item.
78 virtual void Close() = 0;
84 #endif // ASH_SHELF_SHELF_ITEM_DELEGATE_H_