diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-11 23:51:20 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-11 23:51:20 +0000 |
commit | 14831ef6c6fb54bd7aafa1006c5a2650ee6e9097 (patch) | |
tree | 7fb7b566271922e09a25997488b2d9137d50a051 /chrome/browser/tab_contents/render_view_context_menu_mac.h | |
parent | 755fd4806a674e254387e3053857b5475453c8b8 (diff) | |
download | chromium_src-14831ef6c6fb54bd7aafa1006c5a2650ee6e9097.zip chromium_src-14831ef6c6fb54bd7aafa1006c5a2650ee6e9097.tar.gz chromium_src-14831ef6c6fb54bd7aafa1006c5a2650ee6e9097.tar.bz2 |
Re-organize RenderViewContextMenu to the use cross-platform MenuModel class.
Benefits:
- less code
- more straightforward code
- more shared code
unresolved issues:
- RenderViewContextMenu{Gtk,Mac,Views} should not be a subclass of RenderViewContextMenu
- On Linux, IMEs are added in the wrong place (not near the other editable stuff)
BUG=31365
TEST=manual + trybots
Review URL: http://codereview.chromium.org/2017001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46987 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.h | 37 |
1 files changed, 10 insertions, 27 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 ee42bce..2661ffe 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) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -7,9 +7,10 @@ #import <Cocoa/Cocoa.h> +#include "base/scoped_nsobject.h" #include "chrome/browser/tab_contents/render_view_context_menu.h" -@class ContextMenuTarget; +@class MenuController; // 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 @@ -22,35 +23,17 @@ class RenderViewContextMenuMac : public RenderViewContextMenu { NSView* parent_view); virtual ~RenderViewContextMenuMac(); - // Elevate to public so that the obj-c target can call it. - void ExecuteCommand(int command_id) { ExecuteItemCommand(command_id); } - protected: // RenderViewContextMenu implementation- - virtual void DoInit(); - virtual void AppendMenuItem(int id); - virtual void AppendMenuItem(int id, const string16& label); - virtual void AppendRadioMenuItem(int id, const string16& label); - virtual void AppendCheckboxMenuItem(int id, const string16& label); - virtual void AppendSeparator(); - virtual void StartSubMenu(int id, const string16& label); - virtual void FinishSubMenu(); - - // Do things like remove the windows accelerators. - static NSString* PrepareLabelForDisplay(const string16& label); + virtual void PlatformInit(); + virtual bool GetAcceleratorForCommandId( + int command_id, + menus::Accelerator* accelerator) { + return false; + } private: - // Private helper method used by the implementations of the above methods. - // All MenuItems are represented as NSMenuItems no matter what kind they - // are (Normal, Radio, Checkbox). All of the above call this method, providing - // a useful value for |state| based upon some specific lookup, usually based - // on the id. - void AppendMenuItemWithState(int id, const string16& label, - NSCellStateValue state); - NSMenu* menu_; - NSMenu* insert_menu_; // weak, where new items are inserted (usually - // |menu_| unless there's a submenu in progress). - ContextMenuTarget* target_; // obj-c target for menu actions + scoped_nsobject<MenuController> menuController_; NSView* parent_view_; // parent view }; |