Chromium Code Reviews| 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 #include "base/file_path.h" | |
|
Peter Kasting
2012/07/14 02:08:01
Nit: Add blank line here
yefimt
2012/07/17 18:20:37
Done.
| |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "content/public/browser/notification_observer.h" | |
| 12 #include "ui/base/models/button_menu_item_model.h" | |
| 13 #include "ui/base/models/simple_menu_model.h" | |
| 14 | |
| 15 class ExtensionService; | |
| 16 | |
| 17 namespace extensions { | |
| 18 class Extension; | |
| 19 } | |
| 20 | |
| 21 | |
| 22 // A menu model that builds the contents of the action box menu. | |
| 23 class ActionBoxMenuModel : public ui::SimpleMenuModel, | |
| 24 public ui::SimpleMenuModel::Delegate, | |
| 25 public content::NotificationObserver { | |
| 26 public: | |
| 27 explicit ActionBoxMenuModel(ExtensionService* extension_service); | |
| 28 virtual ~ActionBoxMenuModel(); | |
| 29 | |
| 30 // Active box extensions. | |
| 31 size_t action_box_extensions_size(); | |
| 32 const extensions::Extension* GetActionBoxExtensionByIndex(int index); | |
| 33 | |
| 34 private: | |
| 35 // Overridden for both ButtonMenuItemModel::Delegate and SimpleMenuModel | |
| 36 virtual void ExecuteCommand(int command_id) OVERRIDE; | |
| 37 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; | |
| 38 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; | |
| 39 virtual bool GetAcceleratorForCommandId( | |
| 40 int command_id, ui::Accelerator* accelerator) OVERRIDE; | |
|
Peter Kasting
2012/07/14 02:08:01
Nit: One arg per line
yefimt
2012/07/17 18:20:37
Done.
| |
| 41 | |
| 42 // Overridden from content::NotificationObserver: | |
| 43 virtual void Observe(int type, | |
| 44 const content::NotificationSource& source, | |
| 45 const content::NotificationDetails& details) OVERRIDE; | |
| 46 | |
| 47 void Build(); | |
|
Peter Kasting
2012/07/14 02:08:01
What does this do?
yefimt
2012/07/17 18:20:37
Done.
| |
| 48 | |
| 49 ExtensionService* extension_service_; | |
| 50 | |
| 51 typedef std::map<int, std::string> IdToEntensionId; | |
|
Peter Kasting
2012/07/14 02:08:01
Nit: typedef goes atop the private section. Put "
yefimt
2012/07/17 18:20:37
Done.
| |
| 52 IdToEntensionId id_to_extension_id_; | |
| 53 | |
| 54 DISALLOW_COPY_AND_ASSIGN(ActionBoxMenuModel); | |
| 55 }; | |
| 56 | |
| 57 #endif // CHROME_BROWSER_UI_TOOLBAR_ACTION_BOX_MENU_MODEL_H_ | |
| OLD | NEW |