Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / tab_contents / render_view_context_menu_mac.h
blob43afdd72fc9ea233e0cb973337598452943941ae
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 {
19 public:
20 RenderViewContextMenuMac(content::WebContents* web_contents,
21 const content::ContextMenuParams& params,
22 NSView* parent_view);
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,
32 bool enabled,
33 bool hidden,
34 const base::string16& title) OVERRIDE;
36 protected:
37 // RenderViewContextMenu implementation.
38 virtual void PlatformInit() OVERRIDE;
39 virtual void PlatformCancel() OVERRIDE;
40 virtual bool GetAcceleratorForCommandId(
41 int command_id,
42 ui::Accelerator* accelerator) OVERRIDE;
43 virtual void AppendPlatformEditableItems() OVERRIDE;
45 private:
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.
56 void StartSpeaking();
58 // Handler for the "Stop Speaking" menu item.
59 void StopSpeaking();
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.
71 NSView* parent_view_;
73 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenuMac);
76 #endif // CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_MAC_H_