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 CHROME_BROWSER_UI_COCOA_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_M
AC_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_M
AC_H_ |
6 #define CHROME_BROWSER_UI_COCOA_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_M
AC_H_ | 6 #define CHROME_BROWSER_UI_COCOA_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_M
AC_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
11 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" | 11 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" |
12 | 12 |
13 @class MenuController; | 13 @class MenuController; |
14 | 14 |
15 // Mac implementation of the context menu display code. Uses a Cocoa NSMenu | 15 // Mac implementation of the context menu display code. Uses a Cocoa NSMenu |
16 // to display the context menu. Internally uses an obj-c object as the | 16 // to display the context menu. Internally uses an obj-c object as the |
17 // target of the NSMenu, bridging back to this C++ class. | 17 // target of the NSMenu, bridging back to this C++ class. |
18 class RenderViewContextMenuMac : public RenderViewContextMenu { | 18 class RenderViewContextMenuMac : public RenderViewContextMenu { |
19 public: | 19 public: |
20 RenderViewContextMenuMac(content::RenderFrameHost* render_frame_host, | 20 RenderViewContextMenuMac(content::RenderFrameHost* render_frame_host, |
21 const content::ContextMenuParams& params, | 21 const content::ContextMenuParams& params, |
22 NSView* parent_view); | 22 NSView* parent_view); |
23 virtual ~RenderViewContextMenuMac(); | 23 ~RenderViewContextMenuMac() override; |
24 | 24 |
25 // SimpleMenuModel::Delegate implementation. | 25 // SimpleMenuModel::Delegate implementation. |
26 virtual void ExecuteCommand(int command_id, int event_flags) override; | 26 void ExecuteCommand(int command_id, int event_flags) override; |
27 virtual bool IsCommandIdChecked(int command_id) const override; | 27 bool IsCommandIdChecked(int command_id) const override; |
28 virtual bool IsCommandIdEnabled(int command_id) const override; | 28 bool IsCommandIdEnabled(int command_id) const override; |
29 | 29 |
30 void Show(); | 30 void Show(); |
31 | 31 |
32 protected: | 32 protected: |
33 // RenderViewContextMenu implementation. | 33 // RenderViewContextMenu implementation. |
34 virtual bool GetAcceleratorForCommandId( | 34 bool GetAcceleratorForCommandId(int command_id, |
35 int command_id, | 35 ui::Accelerator* accelerator) override; |
36 ui::Accelerator* accelerator) override; | 36 void AppendPlatformEditableItems() override; |
37 virtual void AppendPlatformEditableItems() override; | |
38 | 37 |
39 private: | 38 private: |
40 friend class ToolkitDelegateMac; | 39 friend class ToolkitDelegateMac; |
41 | 40 |
42 // Adds menu to the platform's toolkit. | 41 // Adds menu to the platform's toolkit. |
43 void InitToolkitMenu(); | 42 void InitToolkitMenu(); |
44 | 43 |
45 // Cancels the menu. | 44 // Cancels the menu. |
46 void CancelToolkitMenu(); | 45 void CancelToolkitMenu(); |
47 | 46 |
(...skipping 24 matching lines...) Expand all Loading... |
72 // Model for the BiDi input submenu. | 71 // Model for the BiDi input submenu. |
73 ui::SimpleMenuModel bidi_submenu_model_; | 72 ui::SimpleMenuModel bidi_submenu_model_; |
74 | 73 |
75 // The Cocoa parent view. | 74 // The Cocoa parent view. |
76 NSView* parent_view_; | 75 NSView* parent_view_; |
77 | 76 |
78 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenuMac); | 77 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenuMac); |
79 }; | 78 }; |
80 | 79 |
81 #endif // CHROME_BROWSER_UI_COCOA_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MEN
U_MAC_H_ | 80 #endif // CHROME_BROWSER_UI_COCOA_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MEN
U_MAC_H_ |
OLD | NEW |