Roll src/third_party/WebKit f36d5e0:68b67cd (svn 193299:193303)
[chromium-blink-merge.git] / ash / shelf / shelf_item_delegate.h
blob46f282a018ed45c2bd47f5c0090e16ed405a4148
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 virtual ~ShelfItemDelegate() {}
29 // Invoked when the user clicks on a window entry in the launcher.
30 // |event| is the click event. The |event| is dispatched by a view
31 // and has an instance of |views::View| as the event target
32 // but not |aura::Window|. If the |event| is of type KeyEvent, it is assumed
33 // that this was triggered by keyboard action (Alt+<number>) and special
34 // handling might happen.
35 // Returns true if a new item was created.
36 virtual bool ItemSelected(const ui::Event& event) = 0;
38 // Returns the title to display.
39 virtual base::string16 GetTitle() = 0;
41 // Returns the context menumodel for the specified item on
42 // |root_window|. Return NULL if there should be no context
43 // menu. The caller takes ownership of the returned model.
44 virtual ui::MenuModel* CreateContextMenu(aura::Window* root_window) = 0;
46 // Returns the application menu model for the specified item. There are three
47 // possible return values:
48 // - A return of NULL indicates that no menu is wanted for this item.
49 // - A return of a menu with one item means that only the name of the
50 // application/item was added and there are no active applications.
51 // Note: This is useful for hover menus which also show context help.
52 // - A list containing the title and the active list of items.
53 // The caller takes ownership of the returned model.
54 // |event_flags| specifies the flags of the event which triggered this menu.
55 virtual ShelfMenuModel* CreateApplicationMenu(int event_flags) = 0;
57 // Whether the launcher item is draggable.
58 virtual bool IsDraggable() = 0;
60 // Returns true if a tooltip should be shown.
61 virtual bool ShouldShowTooltip() = 0;
63 // Closes all windows associated with this item.
64 virtual void Close() = 0;
68 } // namespace ash
70 #endif // ASH_SHELF_SHELF_ITEM_DELEGATE_H_