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 "content/public/browser/notification_observer.h" |
| 11 #include "chrome/browser/extensions/extension_service.h" |
| 12 #include "ui/base/models/simple_menu_model.h" |
| 13 |
| 14 namespace extensions { |
| 15 class Extension; |
| 16 } |
| 17 |
| 18 // A menu model that builds the contents of the action box menu. |
| 19 class ActionBoxMenuModel : public ui::SimpleMenuModel, |
| 20 public content::NotificationObserver { |
| 21 public: |
| 22 explicit ActionBoxMenuModel(ExtensionService* extension_service); |
| 23 virtual ~ActionBoxMenuModel(); |
| 24 |
| 25 size_t action_box_extensions_size() { |
| 26 return extension_service_->toolbar_model()->action_box_extensions_size(); |
| 27 } |
| 28 const extensions::Extension* GetActionBoxExtensionByIndex(int index) { |
| 29 return extension_service_->toolbar_model()-> |
| 30 action_box_menu_item_by_index(index); |
| 31 } |
| 32 |
| 33 private: |
| 34 typedef std::map<int, std::string> IdToEntensionIdMap; |
| 35 |
| 36 // Overridden from content::NotificationObserver: |
| 37 virtual void Observe(int type, |
| 38 const content::NotificationSource& source, |
| 39 const content::NotificationDetails& details) OVERRIDE; |
| 40 |
| 41 ExtensionService* extension_service_; |
| 42 |
| 43 IdToEntensionIdMap id_to_extension_id_map_; |
| 44 |
| 45 DISALLOW_COPY_AND_ASSIGN(ActionBoxMenuModel); |
| 46 }; |
| 47 |
| 48 #endif // CHROME_BROWSER_UI_TOOLBAR_ACTION_BOX_MENU_MODEL_H_ |
OLD | NEW |