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_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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 // | 89 // |
90 // // Start a task that creates the final text. | 90 // // Start a task that creates the final text. |
91 // my_task_ = new MyTask(this, IDC_MY_ITEM); | 91 // my_task_ = new MyTask(this, IDC_MY_ITEM); |
92 // my_task_->Start(...); | 92 // my_task_->Start(...); |
93 // } | 93 // } |
94 // | 94 // |
95 class RenderViewContextMenuProxy { | 95 class RenderViewContextMenuProxy { |
96 public: | 96 public: |
97 // Add a menu item to a context menu. | 97 // Add a menu item to a context menu. |
98 virtual void AddMenuItem(int command_id, const string16& title) = 0; | 98 virtual void AddMenuItem(int command_id, const string16& title) = 0; |
| 99 virtual void AddCheckItem(int command_id, const string16& title) = 0; |
99 virtual void AddSeparator() = 0; | 100 virtual void AddSeparator() = 0; |
100 | 101 |
101 // Add a submenu item to a context menu. | 102 // Add a submenu item to a context menu. |
102 virtual void AddSubMenu(int command_id, | 103 virtual void AddSubMenu(int command_id, |
103 const string16& label, | 104 const string16& label, |
104 ui::MenuModel* model) = 0; | 105 ui::MenuModel* model) = 0; |
105 | 106 |
106 // Update the status and text of the specified context-menu item. | 107 // Update the status and text of the specified context-menu item. |
107 virtual void UpdateMenuItem(int command_id, | 108 virtual void UpdateMenuItem(int command_id, |
108 bool enabled, | 109 bool enabled, |
(...skipping 26 matching lines...) Expand all Loading... |
135 // SimpleMenuModel::Delegate implementation. | 136 // SimpleMenuModel::Delegate implementation. |
136 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; | 137 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; |
137 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; | 138 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; |
138 virtual void ExecuteCommand(int command_id) OVERRIDE; | 139 virtual void ExecuteCommand(int command_id) OVERRIDE; |
139 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; | 140 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; |
140 virtual void MenuWillShow(ui::SimpleMenuModel* source) OVERRIDE; | 141 virtual void MenuWillShow(ui::SimpleMenuModel* source) OVERRIDE; |
141 virtual void MenuClosed(ui::SimpleMenuModel* source) OVERRIDE; | 142 virtual void MenuClosed(ui::SimpleMenuModel* source) OVERRIDE; |
142 | 143 |
143 // RenderViewContextMenuDelegate implementation. | 144 // RenderViewContextMenuDelegate implementation. |
144 virtual void AddMenuItem(int command_id, const string16& title) OVERRIDE; | 145 virtual void AddMenuItem(int command_id, const string16& title) OVERRIDE; |
| 146 virtual void AddCheckItem(int command_id, const string16& title) OVERRIDE; |
145 virtual void AddSeparator() OVERRIDE; | 147 virtual void AddSeparator() OVERRIDE; |
146 virtual void AddSubMenu(int command_id, | 148 virtual void AddSubMenu(int command_id, |
147 const string16& label, | 149 const string16& label, |
148 ui::MenuModel* model) OVERRIDE; | 150 ui::MenuModel* model) OVERRIDE; |
149 virtual void UpdateMenuItem(int command_id, | 151 virtual void UpdateMenuItem(int command_id, |
150 bool enabled, | 152 bool enabled, |
151 bool hidden, | 153 bool hidden, |
152 const string16& title) OVERRIDE; | 154 const string16& title) OVERRIDE; |
153 virtual RenderViewHost* GetRenderViewHost() const OVERRIDE; | 155 virtual RenderViewHost* GetRenderViewHost() const OVERRIDE; |
154 virtual Profile* GetProfile() const OVERRIDE; | 156 virtual Profile* GetProfile() const OVERRIDE; |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 // An observer that disables menu items when print preview is active. | 286 // An observer that disables menu items when print preview is active. |
285 scoped_ptr<PrintPreviewContextMenuObserver> print_preview_menu_observer_; | 287 scoped_ptr<PrintPreviewContextMenuObserver> print_preview_menu_observer_; |
286 | 288 |
287 // Our observers. | 289 // Our observers. |
288 mutable ObserverList<RenderViewContextMenuObserver> observers_; | 290 mutable ObserverList<RenderViewContextMenuObserver> observers_; |
289 | 291 |
290 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenu); | 292 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenu); |
291 }; | 293 }; |
292 | 294 |
293 #endif // CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_H_ | 295 #endif // CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_H_ |
OLD | NEW |