summaryrefslogtreecommitdiffstats
path: root/chrome/browser/tab_contents/render_view_context_menu_mac.h
diff options
context:
space:
mode:
authorasvitkine@chromium.org <asvitkine@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-14 06:58:23 +0000
committerasvitkine@chromium.org <asvitkine@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-14 06:58:23 +0000
commitf3768f641af1c80b3fd65aee3392f911606f8258 (patch)
treef44f7acba43122d1b1a905a70c13520f27a83ce9 /chrome/browser/tab_contents/render_view_context_menu_mac.h
parentc7db6e93a71e9c0a1571605c6aed34cb7dc7d2b1 (diff)
downloadchromium_src-f3768f641af1c80b3fd65aee3392f911606f8258.zip
chromium_src-f3768f641af1c80b3fd65aee3392f911606f8258.tar.gz
chromium_src-f3768f641af1c80b3fd65aee3392f911606f8258.tar.bz2
Enable Mac speech support in the context menu to match other Cocoa apps.
This matches Safari and what Mac users generally expect. I'll need to add the same to the Edit menu in a later CL. This also cleans up some style issues and moves the Mac dictionary context menu support to only be known to render_view_context_menu_mac.mm and not the cross-platform render_view_context_menu.cc. BUG=31107, 46153 TEST=Right click on some selected text in the web content area. The context menu should contain a "Speech" submenu with items "Start Speaking" and "Stop Speaking". Try them out. Review URL: http://codereview.chromium.org/9702001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126602 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tab_contents/render_view_context_menu_mac.h')
-rw-r--r--chrome/browser/tab_contents/render_view_context_menu_mac.h36
1 files changed, 28 insertions, 8 deletions
diff --git a/chrome/browser/tab_contents/render_view_context_menu_mac.h b/chrome/browser/tab_contents/render_view_context_menu_mac.h
index e11e8a9..c5d0efe8 100644
--- a/chrome/browser/tab_contents/render_view_context_menu_mac.h
+++ b/chrome/browser/tab_contents/render_view_context_menu_mac.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -16,14 +16,17 @@
// Mac implementation of the context menu display code. Uses a Cocoa NSMenu
// to display the context menu. Internally uses an obj-c object as the
// target of the NSMenu, bridging back to this C++ class.
-
class RenderViewContextMenuMac : public RenderViewContextMenu {
public:
RenderViewContextMenuMac(content::WebContents* web_contents,
const content::ContextMenuParams& params,
NSView* parent_view);
virtual ~RenderViewContextMenuMac();
- virtual void ExecuteCommand(int id) OVERRIDE;
+
+ // SimpleMenuModel::Delegate implementation.
+ virtual void ExecuteCommand(int command_id) OVERRIDE;
+ virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE;
+ virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE;
// RenderViewContextMenuDelegate implementation.
virtual void UpdateMenuItem(int command_id,
@@ -38,12 +41,29 @@ class RenderViewContextMenuMac : public RenderViewContextMenu {
int command_id,
ui::Accelerator* accelerator) OVERRIDE;
- virtual void LookUpInDictionary() OVERRIDE;
-
- void InitPlatformMenu();
private:
- scoped_nsobject<MenuController> menuController_;
- NSView* parent_view_; // parent view
+ // Adds platform-specific items to the menu.
+ void InitPlatformMenu();
+
+ // Handler for the "Look Up in Dictionary" menu item.
+ void LookUpInDictionary();
+
+ // Handler for the "Start Speaking" menu item.
+ void StartSpeaking();
+
+ // Handler for the "Stop Speaking" menu item.
+ void StopSpeaking();
+
+ // The Cocoa menu controller for this menu.
+ scoped_nsobject<MenuController> menu_controller_;
+
+ // Model for the "Speech" submenu.
+ ui::SimpleMenuModel speech_submenu_model_;
+
+ // The Cocoa parent view.
+ NSView* parent_view_;
+
+ DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenuMac);
};
#endif // CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_MAC_H_