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 virtual void ExecuteCommand(int id) OVERRIDE; |
27 | 27 |
28 // RenderViewContextMenuDelegate implementation. | 28 // RenderViewContextMenuDelegate implementation. |
29 virtual void UpdateMenuItem(int command_id, | 29 virtual void UpdateMenuItem(int command_id, |
30 bool enabled, | 30 bool enabled, |
31 bool hidden, | 31 bool hidden, |
32 const string16& title) OVERRIDE; | 32 const string16& title) OVERRIDE; |
33 | 33 |
34 protected: | 34 protected: |
35 // RenderViewContextMenu implementation- | 35 // RenderViewContextMenu implementation. |
36 virtual void PlatformInit(); | 36 virtual void PlatformInit() OVERRIDE; |
37 virtual bool GetAcceleratorForCommandId( | 37 virtual bool GetAcceleratorForCommandId( |
38 int command_id, | 38 int command_id, |
39 ui::Accelerator* accelerator); | 39 ui::Accelerator* accelerator) OVERRIDE; |
40 | 40 |
41 virtual void LookUpInDictionary(); | 41 virtual void LookUpInDictionary() OVERRIDE; |
42 | 42 |
43 void InitPlatformMenu(); | 43 void InitPlatformMenu(); |
44 private: | 44 private: |
45 scoped_nsobject<MenuController> menuController_; | 45 scoped_nsobject<MenuController> menuController_; |
46 NSView* parent_view_; // parent view | 46 NSView* parent_view_; // parent view |
47 }; | 47 }; |
48 | 48 |
49 #endif // CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_MAC_H_ | 49 #endif // CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_MAC_H_ |
OLD | NEW |