OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_BROWSER_UI_TOOLBAR_ACTION_BOX_MENU_MODEL_H_ | 5 #ifndef CHROME_BROWSER_UI_TOOLBAR_ACTION_BOX_MENU_MODEL_H_ |
6 #define CHROME_BROWSER_UI_TOOLBAR_ACTION_BOX_MENU_MODEL_H_ | 6 #define CHROME_BROWSER_UI_TOOLBAR_ACTION_BOX_MENU_MODEL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "content/public/browser/notification_observer.h" | 10 #include "content/public/browser/notification_observer.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 bool starred); | 30 bool starred); |
31 virtual ~ActionBoxMenuModel(); | 31 virtual ~ActionBoxMenuModel(); |
32 | 32 |
33 // Returns true if item associated with an extension. | 33 // Returns true if item associated with an extension. |
34 bool IsItemExtension(int index); | 34 bool IsItemExtension(int index); |
35 | 35 |
36 // Returns an extension associated with model item at |index| | 36 // Returns an extension associated with model item at |index| |
37 // or NULL if it is not an extension item. | 37 // or NULL if it is not an extension item. |
38 const extensions::Extension* GetExtensionAt(int index); | 38 const extensions::Extension* GetExtensionAt(int index); |
39 | 39 |
40 private: | |
41 const extensions::ExtensionList& action_box_menu_items() { | |
42 return extension_service_->toolbar_model()->action_box_menu_items(); | |
43 } | |
44 | |
45 typedef std::map<int, std::string> IdToEntensionIdMap; | |
46 | |
47 // Overridden from ui::SimpleMenuModel::Delegate: | 40 // Overridden from ui::SimpleMenuModel::Delegate: |
48 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; | 41 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; |
49 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; | 42 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; |
50 virtual bool GetAcceleratorForCommandId( | 43 virtual bool GetAcceleratorForCommandId( |
51 int command_id, | 44 int command_id, |
52 ui::Accelerator* accelerator) OVERRIDE; | 45 ui::Accelerator* accelerator) OVERRIDE; |
53 virtual void ExecuteCommand(int command_id) OVERRIDE; | 46 virtual void ExecuteCommand(int command_id) OVERRIDE; |
54 | 47 |
| 48 private: |
| 49 const extensions::ExtensionList& action_box_menu_items() { |
| 50 return extension_service_->toolbar_model()->action_box_menu_items(); |
| 51 } |
| 52 |
| 53 typedef std::map<int, std::string> IdToEntensionIdMap; |
| 54 |
55 // Overridden from content::NotificationObserver: | 55 // Overridden from content::NotificationObserver: |
56 virtual void Observe(int type, | 56 virtual void Observe(int type, |
57 const content::NotificationSource& source, | 57 const content::NotificationSource& source, |
58 const content::NotificationDetails& details) OVERRIDE; | 58 const content::NotificationDetails& details) OVERRIDE; |
59 | 59 |
60 Browser* browser_; | 60 Browser* browser_; |
61 ExtensionService* extension_service_; | 61 ExtensionService* extension_service_; |
62 | 62 |
63 IdToEntensionIdMap id_to_extension_id_map_; | 63 IdToEntensionIdMap id_to_extension_id_map_; |
64 | 64 |
65 DISALLOW_COPY_AND_ASSIGN(ActionBoxMenuModel); | 65 DISALLOW_COPY_AND_ASSIGN(ActionBoxMenuModel); |
66 }; | 66 }; |
67 | 67 |
68 #endif // CHROME_BROWSER_UI_TOOLBAR_ACTION_BOX_MENU_MODEL_H_ | 68 #endif // CHROME_BROWSER_UI_TOOLBAR_ACTION_BOX_MENU_MODEL_H_ |
OLD | NEW |