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 #pragma once |
| 8 |
| 9 #include <map> |
| 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 // Overridden for both ButtonMenuItemModel::Delegate and SimpleMenuModel |
| 37 virtual void ExecuteCommand(int command_id) OVERRIDE; |
| 38 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; |
| 39 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; |
| 40 virtual bool GetAcceleratorForCommandId( |
| 41 int command_id, ui::Accelerator* accelerator) OVERRIDE; |
| 42 |
| 43 // Overridden from content::NotificationObserver: |
| 44 virtual void Observe(int type, |
| 45 const content::NotificationSource& source, |
| 46 const content::NotificationDetails& details) OVERRIDE; |
| 47 |
| 48 void Build(); |
| 49 |
| 50 ExtensionService* extension_service_; |
| 51 |
| 52 typedef std::map<int, std::string> IdToEntensionId; |
| 53 IdToEntensionId id_to_extension_id_; |
| 54 |
| 55 DISALLOW_COPY_AND_ASSIGN(ActionBoxMenuModel); |
| 56 }; |
| 57 |
| 58 #endif // CHROME_BROWSER_UI_TOOLBAR_ACTION_BOX_MENU_MODEL_H_ |
OLD | NEW |