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

Side by Side Diff: ash/launcher/launcher_item_delegate.h

Issue 23606016: Refactor LauncherItemController and LauncherItemDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix for unittest.. Created 7 years, 2 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
« no previous file with comments | « ash/launcher/launcher_delegate.h ('k') | ash/launcher/launcher_item_delegate_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_LAUNCHER_LAUNCHER_ITEM_DELEGATE_H_ 5 #ifndef ASH_LAUNCHER_LAUNCHER_ITEM_DELEGATE_H_
6 #define ASH_LAUNCHER_LAUNCHER_ITEM_DELEGATE_H_ 6 #define ASH_LAUNCHER_LAUNCHER_ITEM_DELEGATE_H_
7 7
8 #include "ash/ash_export.h" 8 #include "ash/ash_export.h"
9 #include "ash/launcher/launcher_types.h" 9 #include "ash/launcher/launcher_types.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 17 matching lines...) Expand all
28 28
29 // Returns |true| when the given |command_id| is active and needs to be drawn 29 // Returns |true| when the given |command_id| is active and needs to be drawn
30 // in a special state. 30 // in a special state.
31 virtual bool IsCommandActive(int command_id) const = 0; 31 virtual bool IsCommandActive(int command_id) const = 0;
32 32
33 private: 33 private:
34 DISALLOW_COPY_AND_ASSIGN(LauncherMenuModel); 34 DISALLOW_COPY_AND_ASSIGN(LauncherMenuModel);
35 }; 35 };
36 36
37 // Delegate for the LauncherItem. 37 // Delegate for the LauncherItem.
38 // TODO(simon.hong81): Remove LauncherItem from abstract function parameters.
39 class ASH_EXPORT LauncherItemDelegate { 38 class ASH_EXPORT LauncherItemDelegate {
40 public: 39 public:
41 virtual ~LauncherItemDelegate() {} 40 virtual ~LauncherItemDelegate() {}
42 41
43 // Invoked when the user clicks on a window entry in the launcher. 42 // 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 43 // |event| is the click event. The |event| is dispatched by a view
45 // and has an instance of |views::View| as the event target 44 // 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 45 // 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 46 // that this was triggered by keyboard action (Alt+<number>) and special
48 // handling might happen. 47 // handling might happen.
49 virtual void ItemSelected(const LauncherItem& item, 48 virtual void ItemSelected(const ui::Event& event) = 0;
50 const ui::Event& event) = 0;
51 49
52 // Returns the title to display for the specified launcher item. 50 // Returns the title to display.
53 virtual base::string16 GetTitle(const LauncherItem& item) = 0; 51 virtual base::string16 GetTitle() = 0;
54 52
55 // Returns the context menumodel for the specified item on 53 // Returns the context menumodel for the specified item on
56 // |root_window|. Return NULL if there should be no context 54 // |root_window|. Return NULL if there should be no context
57 // menu. The caller takes ownership of the returned model. 55 // menu. The caller takes ownership of the returned model.
58 virtual ui::MenuModel* CreateContextMenu(const LauncherItem& item, 56 virtual ui::MenuModel* CreateContextMenu(aura::RootWindow* root_window) = 0;
59 aura::RootWindow* root_window) = 0;
60 57
61 // Returns the application menu model for the specified item. There are three 58 // Returns the application menu model for the specified item. There are three
62 // possible return values: 59 // possible return values:
63 // - A return of NULL indicates that no menu is wanted for this item. 60 // - A return of NULL indicates that no menu is wanted for this item.
64 // - A return of a menu with one item means that only the name of the 61 // - A return of a menu with one item means that only the name of the
65 // application/item was added and there are no active applications. 62 // application/item was added and there are no active applications.
66 // Note: This is useful for hover menus which also show context help. 63 // Note: This is useful for hover menus which also show context help.
67 // - A list containing the title and the active list of items. 64 // - A list containing the title and the active list of items.
68 // The caller takes ownership of the returned model. 65 // The caller takes ownership of the returned model.
69 // |event_flags| specifies the flags of the event which triggered this menu. 66 // |event_flags| specifies the flags of the event which triggered this menu.
70 virtual LauncherMenuModel* CreateApplicationMenu( 67 virtual ash::LauncherMenuModel* CreateApplicationMenu(int event_flags) = 0;
71 const LauncherItem& item,
72 int event_flags) = 0;
73 68
74 // Whether the given launcher item is draggable. 69 // Whether the launcher item is draggable.
75 virtual bool IsDraggable(const LauncherItem& item) = 0; 70 virtual bool IsDraggable() = 0;
76 71
77 // Returns true if a tooltip should be shown for the item. 72 // Returns true if a tooltip should be shown.
78 virtual bool ShouldShowTooltip(const LauncherItem& item) = 0; 73 virtual bool ShouldShowTooltip() = 0;
79 }; 74 };
80 75
81 } // namespace ash 76 } // namespace ash
82 77
83 #endif // ASH_LAUNCHER_LAUNCHER_ITEM_DELEGATE_H_ 78 #endif // ASH_LAUNCHER_LAUNCHER_ITEM_DELEGATE_H_
OLDNEW
« no previous file with comments | « ash/launcher/launcher_delegate.h ('k') | ash/launcher/launcher_item_delegate_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698