1424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved.
2424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
3424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)// found in the LICENSE file.
4424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)
5a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#ifndef ASH_SHELF_SHELF_ITEM_DELEGATE_H_
6a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#define ASH_SHELF_SHELF_ITEM_DELEGATE_H_
7424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)
8424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)#include "ash/ash_export.h"
9424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)#include "base/strings/string16.h"
10424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)
11424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)namespace aura {
12a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)class Window;
13424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)}
14424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)
15424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)namespace ui {
16424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)class Event;
17a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)class MenuModel;
18424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)}
19424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)
20424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)namespace ash {
21424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)
22a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)class ShelfMenuModel;
23424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)
245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Delegate for the ShelfItem.
25a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)class ASH_EXPORT ShelfItemDelegate {
26424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) public:
27a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  virtual ~ShelfItemDelegate() {}
28424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)
29424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  // Invoked when the user clicks on a window entry in the launcher.
30424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  // |event| is the click event. The |event| is dispatched by a view
31424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  // and has an instance of |views::View| as the event target
32424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  // but not |aura::Window|. If the |event| is of type KeyEvent, it is assumed
33424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  // that this was triggered by keyboard action (Alt+<number>) and special
34424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  // handling might happen.
35f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // Returns true if a new item was created.
36f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual bool ItemSelected(const ui::Event& event) = 0;
37424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)
384e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  // Returns the title to display.
394e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  virtual base::string16 GetTitle() = 0;
40424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)
41424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  // Returns the context menumodel for the specified item on
42424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  // |root_window|.  Return NULL if there should be no context
43424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  // menu. The caller takes ownership of the returned model.
441e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  virtual ui::MenuModel* CreateContextMenu(aura::Window* root_window) = 0;
45424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)
46424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  // Returns the application menu model for the specified item. There are three
47424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  // possible return values:
48424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  //  - A return of NULL indicates that no menu is wanted for this item.
49424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  //  - A return of a menu with one item means that only the name of the
50424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  //    application/item was added and there are no active applications.
51424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  //    Note: This is useful for hover menus which also show context help.
52424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  //  - A list containing the title and the active list of items.
53424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  // The caller takes ownership of the returned model.
54424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  // |event_flags| specifies the flags of the event which triggered this menu.
55a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  virtual ShelfMenuModel* CreateApplicationMenu(int event_flags) = 0;
56424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)
574e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  // Whether the launcher item is draggable.
584e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  virtual bool IsDraggable() = 0;
59424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)
604e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  // Returns true if a tooltip should be shown.
614e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  virtual bool ShouldShowTooltip() = 0;
625d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
635d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Closes all windows associated with this item.
645d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual void Close() = 0;
655d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
66424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)};
67424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)
68424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)}  // namespace ash
69424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)
70a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#endif  // ASH_SHELF_SHELF_ITEM_DELEGATE_H_
71