OLD | NEW |
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 UI_APP_LIST_APP_LIST_MENU_H_ | 5 #ifndef UI_APP_LIST_APP_LIST_MENU_H_ |
6 #define UI_APP_LIST_APP_LIST_MENU_H_ | 6 #define UI_APP_LIST_APP_LIST_MENU_H_ |
7 | 7 |
8 #include "ui/app_list/app_list_model.h" | 8 #include "ui/app_list/app_list_view_delegate.h" |
9 #include "ui/base/models/simple_menu_model.h" | 9 #include "ui/base/models/simple_menu_model.h" |
10 | 10 |
11 namespace app_list { | 11 namespace app_list { |
12 | 12 |
13 class AppListViewDelegate; | |
14 | |
15 // Menu for the app list. This is shown in the top right hand corner of the | 13 // Menu for the app list. This is shown in the top right hand corner of the |
16 // app list. | 14 // app list. |
17 // TODO(benwells): We should consider moving this into Chrome. | 15 // TODO(benwells): We should consider moving this into Chrome. |
18 class AppListMenu : public ui::SimpleMenuModel::Delegate { | 16 class AppListMenu : public ui::SimpleMenuModel::Delegate { |
19 public: | 17 public: |
20 enum AppListMenuCommands { | 18 enum AppListMenuCommands { |
21 SHOW_SETTINGS, | 19 SHOW_SETTINGS, |
22 SHOW_HELP, | 20 SHOW_HELP, |
23 SHOW_FEEDBACK, | 21 SHOW_FEEDBACK, |
24 // |SELECT_PROFILE| must remain the last enum because values greater than | 22 // |SELECT_PROFILE| must remain the last enum because values greater than |
25 // |SELECT_PROFILE| are used to indicate a profile index. | 23 // |SELECT_PROFILE| are used to indicate a profile index. |
26 SELECT_PROFILE, | 24 SELECT_PROFILE, |
27 }; | 25 }; |
28 | 26 |
29 AppListMenu( | 27 explicit AppListMenu(AppListViewDelegate* delegate); |
30 AppListViewDelegate* delegate, | |
31 const AppListModel::Users& users); | |
32 virtual ~AppListMenu(); | 28 virtual ~AppListMenu(); |
33 | 29 |
34 ui::SimpleMenuModel* menu_model() { return &menu_model_; } | 30 ui::SimpleMenuModel* menu_model() { return &menu_model_; } |
35 | 31 |
36 private: | 32 private: |
37 void InitMenu(); | 33 void InitMenu(); |
38 | 34 |
39 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; | 35 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; |
40 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; | 36 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; |
41 virtual bool GetAcceleratorForCommandId( | 37 virtual bool GetAcceleratorForCommandId( |
42 int command_id, | 38 int command_id, |
43 ui::Accelerator* accelerator) OVERRIDE; | 39 ui::Accelerator* accelerator) OVERRIDE; |
44 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; | 40 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; |
45 | 41 |
46 ui::SimpleMenuModel menu_model_; | 42 ui::SimpleMenuModel menu_model_; |
47 AppListViewDelegate* delegate_; | 43 AppListViewDelegate* delegate_; |
48 AppListModel::Users users_; | 44 AppListViewDelegate::Users users_; |
49 | 45 |
50 DISALLOW_COPY_AND_ASSIGN(AppListMenu); | 46 DISALLOW_COPY_AND_ASSIGN(AppListMenu); |
51 }; | 47 }; |
52 | 48 |
53 } // namespace app_list | 49 } // namespace app_list |
54 | 50 |
55 #endif // UI_APP_LIST_APP_LIST_MENU_H_ | 51 #endif // UI_APP_LIST_APP_LIST_MENU_H_ |
OLD | NEW |