OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_H_ | 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_H_ |
6 #define CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_H_ | 6 #define CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 // } | 87 // } |
88 // | 88 // |
89 class RenderViewContextMenuProxy { | 89 class RenderViewContextMenuProxy { |
90 public: | 90 public: |
91 // Add a menu item to a context menu. | 91 // Add a menu item to a context menu. |
92 virtual void AddMenuItem(int command_id, const string16& title) = 0; | 92 virtual void AddMenuItem(int command_id, const string16& title) = 0; |
93 | 93 |
94 // Update the status and text of the specified context-menu item. | 94 // Update the status and text of the specified context-menu item. |
95 virtual void UpdateMenuItem(int command_id, | 95 virtual void UpdateMenuItem(int command_id, |
96 bool enabled, | 96 bool enabled, |
| 97 bool hidden, |
97 const string16& title) = 0; | 98 const string16& title) = 0; |
98 | 99 |
99 // Retrieve the RenderViewHost (or Profile) instance associated with a context | 100 // Retrieve the RenderViewHost (or Profile) instance associated with a context |
100 // menu, respectively. | 101 // menu, respectively. |
101 virtual RenderViewHost* GetRenderViewHost() const = 0; | 102 virtual RenderViewHost* GetRenderViewHost() const = 0; |
102 virtual Profile* GetProfile() const = 0; | 103 virtual Profile* GetProfile() const = 0; |
103 }; | 104 }; |
104 | 105 |
105 class RenderViewContextMenu : public ui::SimpleMenuModel::Delegate, | 106 class RenderViewContextMenu : public ui::SimpleMenuModel::Delegate, |
106 public RenderViewContextMenuProxy { | 107 public RenderViewContextMenuProxy { |
(...skipping 17 matching lines...) Expand all Loading... |
124 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; | 125 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; |
125 virtual void ExecuteCommand(int command_id) OVERRIDE; | 126 virtual void ExecuteCommand(int command_id) OVERRIDE; |
126 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; | 127 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; |
127 virtual void MenuWillShow(ui::SimpleMenuModel* source) OVERRIDE; | 128 virtual void MenuWillShow(ui::SimpleMenuModel* source) OVERRIDE; |
128 virtual void MenuClosed(ui::SimpleMenuModel* source) OVERRIDE; | 129 virtual void MenuClosed(ui::SimpleMenuModel* source) OVERRIDE; |
129 | 130 |
130 // RenderViewContextMenuDelegate implementation. | 131 // RenderViewContextMenuDelegate implementation. |
131 virtual void AddMenuItem(int command_id, const string16& title) OVERRIDE; | 132 virtual void AddMenuItem(int command_id, const string16& title) OVERRIDE; |
132 virtual void UpdateMenuItem(int command_id, | 133 virtual void UpdateMenuItem(int command_id, |
133 bool enabled, | 134 bool enabled, |
| 135 bool hidden, |
134 const string16& title) OVERRIDE; | 136 const string16& title) OVERRIDE; |
135 virtual RenderViewHost* GetRenderViewHost() const; | 137 virtual RenderViewHost* GetRenderViewHost() const; |
136 virtual Profile* GetProfile() const; | 138 virtual Profile* GetProfile() const; |
137 | 139 |
138 protected: | 140 protected: |
139 void InitMenu(); | 141 void InitMenu(); |
140 | 142 |
141 // Platform specific functions. | 143 // Platform specific functions. |
142 virtual void PlatformInit() = 0; | 144 virtual void PlatformInit() = 0; |
143 virtual bool GetAcceleratorForCommandId( | 145 virtual bool GetAcceleratorForCommandId( |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 // An observer that handles a spelling-menu items. | 255 // An observer that handles a spelling-menu items. |
254 scoped_ptr<SpellingMenuObserver> spelling_menu_observer_; | 256 scoped_ptr<SpellingMenuObserver> spelling_menu_observer_; |
255 | 257 |
256 // Our observers. | 258 // Our observers. |
257 mutable ObserverList<RenderViewContextMenuObserver> observers_; | 259 mutable ObserverList<RenderViewContextMenuObserver> observers_; |
258 | 260 |
259 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenu); | 261 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenu); |
260 }; | 262 }; |
261 | 263 |
262 #endif // CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_H_ | 264 #endif // CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_H_ |
OLD | NEW |