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 3 // found in the LICENSE file. 4 5 #ifndef 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 8 9 #import <Cocoa/Cocoa.h> 10 11 #include "base/memory/scoped_nsobject.h" 12 #include "chrome/browser/tab_contents/render_view_context_menu.h" 13 14 @class MenuController; 15 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 18 // target of the NSMenu, bridging back to this C++ class. 19 20 class RenderViewContextMenuMac : public RenderViewContextMenu { 21 public: 22 RenderViewContextMenuMac(TabContents* web_contents, 23 const ContextMenuParams& params, 24 NSView* parent_view); 25 virtual ~RenderViewContextMenuMac(); 26 virtual void ExecuteCommand(int id); 27 28 protected: 29 // RenderViewContextMenu implementation- 30 virtual void PlatformInit(); 31 virtual bool GetAcceleratorForCommandId( 32 int command_id, 33 ui::Accelerator* accelerator); 34 35 virtual void LookUpInDictionary(); 36 37 void InitPlatformMenu(); 38 private: 39 scoped_nsobject<MenuController> menuController_; 40 NSView* parent_view_; // parent view 41 }; 42 43 #endif // CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_MAC_H_ 44