OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 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. | |
4 | |
5 #ifndef CHROME_BROWSER_UI_TOOLBAR_ACTION_BOX_MENU_MODEL_H_ | |
6 #define CHROME_BROWSER_UI_TOOLBAR_ACTION_BOX_MENU_MODEL_H_ | |
7 | |
8 #include <map> | |
9 | |
10 #include "base/file_path.h" | |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "content/public/browser/notification_observer.h" | |
13 #include "ui/base/models/button_menu_item_model.h" | |
14 #include "ui/base/models/simple_menu_model.h" | |
15 | |
16 class ExtensionService; | |
17 | |
18 namespace extensions { | |
19 class Extension; | |
20 } | |
21 | |
22 | |
23 // A menu model that builds the contents of the action box menu. | |
24 class ActionBoxMenuModel : public ui::SimpleMenuModel, | |
25 public ui::SimpleMenuModel::Delegate, | |
26 public content::NotificationObserver { | |
27 public: | |
28 explicit ActionBoxMenuModel(ExtensionService* extension_service); | |
29 virtual ~ActionBoxMenuModel(); | |
30 | |
31 // Active box extensions. | |
32 size_t action_box_extensions_size(); | |
33 const extensions::Extension* GetActionBoxExtensionByIndex(int index); | |
34 | |
35 private: | |
36 typedef std::map<int, std::string> IdToEntensionIdMap; | |
37 | |
38 // Overridden for both ButtonMenuItemModel::Delegate and SimpleMenuModel. | |
Peter Kasting
2012/07/18 01:37:25
Nit: This class does not subclass ButtonMenuItemMo
yefimt
2012/07/18 23:18:13
Done.
| |
39 virtual void ExecuteCommand(int command_id) OVERRIDE; | |
40 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; | |
41 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; | |
42 virtual bool GetAcceleratorForCommandId( | |
43 int command_id, | |
44 ui::Accelerator* accelerator) OVERRIDE; | |
45 | |
46 // Overridden from content::NotificationObserver: | |
47 virtual void Observe(int type, | |
48 const content::NotificationSource& source, | |
49 const content::NotificationDetails& details) OVERRIDE; | |
50 | |
51 // Adds extensions to the model. | |
52 void Build(); | |
53 | |
54 ExtensionService* extension_service_; | |
55 | |
56 IdToEntensionIdMap id_to_extension_id_; | |
57 | |
58 DISALLOW_COPY_AND_ASSIGN(ActionBoxMenuModel); | |
59 }; | |
60 | |
61 #endif // CHROME_BROWSER_UI_TOOLBAR_ACTION_BOX_MENU_MODEL_H_ | |
OLD | NEW |