Update V8 to version 4.7.47.
[chromium-blink-merge.git] / ash / shelf / shelf_item_delegate.h
blob41bc0b66e4c23da301891590c5a73519fbdad9a7
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"
11 namespace aura {
12 class Window;
15 namespace ui {
16 class Event;
17 class MenuModel;
20 namespace ash {
22 class ShelfMenuModel;
24 // Delegate for the ShelfItem.
25 class ASH_EXPORT ShelfItemDelegate {
26 public:
27 // The return type for the ShelfItemDelegate::ItemSelected method.
28 enum PerformedAction {
29 // No action was taken.
30 kNoAction,
31 // A new window was created.
32 kNewWindowCreated,
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.
38 kAppListMenuShown,
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;
82 } // namespace ash
84 #endif // ASH_SHELF_SHELF_ITEM_DELEGATE_H_