1 // Copyright (c) 2012 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.
5 #ifndef CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_MAC_H_
6 #define CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_MAC_H_
8 #import <Cocoa/Cocoa.h>
10 #include "base/mac/scoped_nsobject.h"
11 #include "chrome/browser/tab_contents/render_view_context_menu.h"
13 @
class MenuController
;
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
17 // target of the NSMenu, bridging back to this C++ class.
18 class RenderViewContextMenuMac
: public RenderViewContextMenu
{
20 RenderViewContextMenuMac(content::WebContents
* web_contents
,
21 const content::ContextMenuParams
& params
,
23 virtual ~RenderViewContextMenuMac();
25 // SimpleMenuModel::Delegate implementation.
26 virtual void ExecuteCommand(int command_id
, int event_flags
) OVERRIDE
;
27 virtual bool IsCommandIdChecked(int command_id
) const OVERRIDE
;
28 virtual bool IsCommandIdEnabled(int command_id
) const OVERRIDE
;
30 // RenderViewContextMenuDelegate implementation.
31 virtual void UpdateMenuItem(int command_id
,
34 const base::string16
& title
) OVERRIDE
;
37 // RenderViewContextMenu implementation.
38 virtual void PlatformInit() OVERRIDE
;
39 virtual void PlatformCancel() OVERRIDE
;
40 virtual bool GetAcceleratorForCommandId(
42 ui::Accelerator
* accelerator
) OVERRIDE
;
43 virtual void AppendPlatformEditableItems() OVERRIDE
;
46 // Adds platform-specific items to the menu.
47 void InitPlatformMenu();
49 // Adds writing direction submenu.
50 void AppendBidiSubMenu();
52 // Handler for the "Look Up in Dictionary" menu item.
53 void LookUpInDictionary();
55 // Handler for the "Start Speaking" menu item.
58 // Handler for the "Stop Speaking" menu item.
61 // The Cocoa menu controller for this menu.
62 base::scoped_nsobject
<MenuController
> menu_controller_
;
64 // Model for the "Speech" submenu.
65 ui::SimpleMenuModel speech_submenu_model_
;
67 // Model for the BiDi input submenu.
68 ui::SimpleMenuModel bidi_submenu_model_
;
70 // The Cocoa parent view.
73 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenuMac
);
76 #endif // CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_MAC_H_