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