Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(484)

Side by Side Diff: ash/common/shelf/shelf_item_delegate.h

Issue 2671923002: mash: Cleanup ash shelf application menu code. (Closed)
Patch Set: Address comments. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ASH_COMMON_SHELF_SHELF_ITEM_DELEGATE_H_ 5 #ifndef ASH_COMMON_SHELF_SHELF_ITEM_DELEGATE_H_
6 #define ASH_COMMON_SHELF_SHELF_ITEM_DELEGATE_H_ 6 #define ASH_COMMON_SHELF_SHELF_ITEM_DELEGATE_H_
7 7
8 #include "ash/ash_export.h" 8 #include "ash/ash_export.h"
9 #include "base/strings/string16.h" 9 #include "ash/public/cpp/shelf_application_menu_item.h"
10 10
11 namespace ui { 11 namespace ui {
12 class Event; 12 class Event;
13 class SimpleMenuModel;
14 } 13 }
15 14
16 namespace ash { 15 namespace ash {
17 16
18 // Delegate for the ShelfItem. 17 // Delegate for the ShelfItem.
19 class ASH_EXPORT ShelfItemDelegate { 18 class ASH_EXPORT ShelfItemDelegate {
20 public: 19 public:
21 // The return type for the ShelfItemDelegate::ItemSelected method. 20 // The return type for the ShelfItemDelegate::ItemSelected method.
22 enum PerformedAction { 21 enum PerformedAction {
23 // No action was taken. 22 // No action was taken.
(...skipping 12 matching lines...) Expand all
36 35
37 // Invoked when the user clicks on a window entry in the launcher. 36 // Invoked when the user clicks on a window entry in the launcher.
38 // |event| is the click event. The |event| is dispatched by a view 37 // |event| is the click event. The |event| is dispatched by a view
39 // and has an instance of |views::View| as the event target 38 // and has an instance of |views::View| as the event target
40 // but not |aura::Window|. If the |event| is of type KeyEvent, it is assumed 39 // but not |aura::Window|. If the |event| is of type KeyEvent, it is assumed
41 // that this was triggered by keyboard action (Alt+<number>) and special 40 // that this was triggered by keyboard action (Alt+<number>) and special
42 // handling might happen. 41 // handling might happen.
43 // Returns the action performed by selecting the item. 42 // Returns the action performed by selecting the item.
44 virtual PerformedAction ItemSelected(const ui::Event& event) = 0; 43 virtual PerformedAction ItemSelected(const ui::Event& event) = 0;
45 44
46 // Returns the application menu model for the specified item. There are three 45 // Returns any application menu items that should appear for this shelf item.
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. 46 // |event_flags| specifies the flags of the event which triggered this menu.
55 virtual ui::SimpleMenuModel* CreateApplicationMenu(int event_flags) = 0; 47 virtual ShelfAppMenuItemList GetAppMenuItems(int event_flags) = 0;
56 48
57 // Closes all windows associated with this item. 49 // Closes all windows associated with this item.
58 virtual void Close() = 0; 50 virtual void Close() = 0;
59 }; 51 };
60 52
61 } // namespace ash 53 } // namespace ash
62 54
63 #endif // ASH_COMMON_SHELF_SHELF_ITEM_DELEGATE_H_ 55 #endif // ASH_COMMON_SHELF_SHELF_ITEM_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698