| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_OBSERVER_H_ | 5 #ifndef COMPONENTS_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_OBSERVER_H_ |
| 6 #define COMPONENTS_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_OBSERVER_H_ | 6 #define COMPONENTS_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_OBSERVER_H_ |
| 7 | 7 |
| 8 namespace content { | 8 namespace content { |
| 9 struct ContextMenuParams; | 9 struct ContextMenuParams; |
| 10 } | 10 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // | 25 // |
| 26 // 3. Create a class that implements this interface. (It is a good idea to use | 26 // 3. Create a class that implements this interface. (It is a good idea to use |
| 27 // the RenderViewContextMenuProxy interface to avoid accessing the | 27 // the RenderViewContextMenuProxy interface to avoid accessing the |
| 28 // RenderViewContextMenu class directly.) | 28 // RenderViewContextMenu class directly.) |
| 29 // | 29 // |
| 30 // class MyMenuObserver : public RenderViewContextMenuObserver { | 30 // class MyMenuObserver : public RenderViewContextMenuObserver { |
| 31 // public: | 31 // public: |
| 32 // MyMenuObserver(RenderViewContextMenuProxy* p); | 32 // MyMenuObserver(RenderViewContextMenuProxy* p); |
| 33 // ~MyMenuObserver(); | 33 // ~MyMenuObserver(); |
| 34 // | 34 // |
| 35 // virtual void InitMenu(const content::ContextMenuParams& params) OVERRIDE; | 35 // virtual void InitMenu(const content::ContextMenuParams& params) override; |
| 36 // virtual bool IsCommandIdSupported(int command_id) OVERRIDE; | 36 // virtual bool IsCommandIdSupported(int command_id) override; |
| 37 // virtual bool IsCommandIdEnabled(int command_id) OVERRIDE; | 37 // virtual bool IsCommandIdEnabled(int command_id) override; |
| 38 // virtual void ExecuteCommand(int command_id) OVERRIDE; | 38 // virtual void ExecuteCommand(int command_id) override; |
| 39 // | 39 // |
| 40 // private: | 40 // private: |
| 41 // RenderViewContextMenuProxy* proxy_; | 41 // RenderViewContextMenuProxy* proxy_; |
| 42 // } | 42 // } |
| 43 // | 43 // |
| 44 // void MyMenuObserver::InitMenu(const content::ContextMenuParams& params) { | 44 // void MyMenuObserver::InitMenu(const content::ContextMenuParams& params) { |
| 45 // proxy_->AddMenuItem(IDC_MY_COMMAND,...); | 45 // proxy_->AddMenuItem(IDC_MY_COMMAND,...); |
| 46 // } | 46 // } |
| 47 // | 47 // |
| 48 // bool MyMenuObserver::IsCommandIdSupported(int command_id) { | 48 // bool MyMenuObserver::IsCommandIdSupported(int command_id) { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 virtual bool IsCommandIdEnabled(int command_id); | 98 virtual bool IsCommandIdEnabled(int command_id); |
| 99 | 99 |
| 100 // Called when a user selects the specified context-menu item. | 100 // Called when a user selects the specified context-menu item. |
| 101 virtual void ExecuteCommand(int command_id) {} | 101 virtual void ExecuteCommand(int command_id) {} |
| 102 | 102 |
| 103 // Called when a user closes the context menu without selecting any items. | 103 // Called when a user closes the context menu without selecting any items. |
| 104 virtual void OnMenuCancel() {} | 104 virtual void OnMenuCancel() {} |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 #endif // COMPONENTS_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_OBSERVER_H_ | 107 #endif // COMPONENTS_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_OBSERVER_H_ |
| OLD | NEW |