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_MAC_H_ | 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_MAC_H_ |
6 #define CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_MAC_H_ | 6 #define CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_MAC_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #import <Cocoa/Cocoa.h> | 9 #import <Cocoa/Cocoa.h> |
10 | 10 |
11 #include "base/memory/scoped_nsobject.h" | 11 #include "base/memory/scoped_nsobject.h" |
12 #include "chrome/browser/tab_contents/render_view_context_menu.h" | 12 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
13 | 13 |
14 @class MenuController; | 14 @class MenuController; |
15 | 15 |
16 // Mac implementation of the context menu display code. Uses a Cocoa NSMenu | 16 // Mac implementation of the context menu display code. Uses a Cocoa NSMenu |
17 // to display the context menu. Internally uses an obj-c object as the | 17 // to display the context menu. Internally uses an obj-c object as the |
18 // target of the NSMenu, bridging back to this C++ class. | 18 // target of the NSMenu, bridging back to this C++ class. |
19 | 19 |
20 class RenderViewContextMenuMac : public RenderViewContextMenu { | 20 class RenderViewContextMenuMac : public RenderViewContextMenu { |
21 public: | 21 public: |
22 RenderViewContextMenuMac(TabContents* web_contents, | 22 RenderViewContextMenuMac(TabContents* web_contents, |
23 const ContextMenuParams& params, | 23 const ContextMenuParams& params, |
24 NSView* parent_view); | 24 NSView* parent_view); |
25 virtual ~RenderViewContextMenuMac(); | 25 virtual ~RenderViewContextMenuMac(); |
| 26 virtual void ExecuteCommand(int id); |
26 | 27 |
27 protected: | 28 protected: |
28 // RenderViewContextMenu implementation- | 29 // RenderViewContextMenu implementation- |
29 virtual void PlatformInit(); | 30 virtual void PlatformInit(); |
30 virtual bool GetAcceleratorForCommandId( | 31 virtual bool GetAcceleratorForCommandId( |
31 int command_id, | 32 int command_id, |
32 ui::Accelerator* accelerator); | 33 ui::Accelerator* accelerator); |
33 | 34 |
34 virtual void LookUpInDictionary(); | 35 virtual void LookUpInDictionary(); |
35 | 36 |
36 void InitPlatformMenu(); | 37 void InitPlatformMenu(); |
37 private: | 38 private: |
38 scoped_nsobject<MenuController> menuController_; | 39 scoped_nsobject<MenuController> menuController_; |
39 NSView* parent_view_; // parent view | 40 NSView* parent_view_; // parent view |
40 }; | 41 }; |
41 | 42 |
42 #endif // CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_MAC_H_ | 43 #endif // CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_MAC_H_ |
OLD | NEW |