| Index: chrome/browser/ui/cocoa/renderer_context_menu/render_view_context_menu_mac.h
|
| diff --git a/chrome/browser/ui/cocoa/renderer_context_menu/render_view_context_menu_mac.h b/chrome/browser/ui/cocoa/renderer_context_menu/render_view_context_menu_mac.h
|
| index 05159cbe9da20ee915a378e5160fe0ee459445bd..f4df94e3a12c1c73038cc80e0f34c36a2175fbec 100644
|
| --- a/chrome/browser/ui/cocoa/renderer_context_menu/render_view_context_menu_mac.h
|
| +++ b/chrome/browser/ui/cocoa/renderer_context_menu/render_view_context_menu_mac.h
|
| @@ -10,30 +10,36 @@
|
| #include "base/mac/scoped_nsobject.h"
|
| #include "base/macros.h"
|
| #include "chrome/browser/renderer_context_menu/render_view_context_menu.h"
|
| +#include "ui/base/cocoa/text_services_context_menu.h"
|
|
|
| @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
|
| // target of the NSMenu, bridging back to this C++ class.
|
| -class RenderViewContextMenuMac : public RenderViewContextMenu {
|
| +class RenderViewContextMenuMac : public RenderViewContextMenu,
|
| + public ui::TextServicesContextMenu::Delegate {
|
| public:
|
| RenderViewContextMenuMac(content::RenderFrameHost* render_frame_host,
|
| const content::ContextMenuParams& params,
|
| NSView* parent_view);
|
| ~RenderViewContextMenuMac() override;
|
|
|
| - // SimpleMenuModel::Delegate implementation.
|
| - void ExecuteCommand(int command_id, int event_flags) override;
|
| + // SimpleMenuModel::Delegate:
|
| bool IsCommandIdChecked(int command_id) const override;
|
| bool IsCommandIdEnabled(int command_id) const override;
|
| + void ExecuteCommand(int command_id, int event_flags) override;
|
|
|
| - // RenderViewContextMenuBase implementation.
|
| - void Show() override;
|
| + // TextServicesContextMenu::Delegate:
|
| + base::string16 GetSelectedText() const override;
|
| + bool IsTextDirectionEnabled(
|
| + base::i18n::TextDirection direction) const override;
|
| + bool IsTextDirectionChecked(
|
| + base::i18n::TextDirection direction) const override;
|
| + void UpdateTextDirection(base::i18n::TextDirection direction) override;
|
|
|
| - protected:
|
| - // RenderViewContextMenu implementation.
|
| - void AppendPlatformEditableItems() override;
|
| + // RenderViewContextMenuBase:
|
| + void Show() override;
|
|
|
| private:
|
| friend class ToolkitDelegateMac;
|
| @@ -50,30 +56,21 @@ class RenderViewContextMenuMac : public RenderViewContextMenu {
|
| bool hidden,
|
| const base::string16& title);
|
|
|
| - // Adds writing direction submenu.
|
| - void AppendBidiSubMenu();
|
| -
|
| - // Handler for the "Look Up in Dictionary" menu item.
|
| + // Handler for the "Look Up" menu item.
|
| void LookUpInDictionary();
|
|
|
| - // Handler for the "Start Speaking" menu item.
|
| - void StartSpeaking();
|
| -
|
| - // Handler for the "Stop Speaking" menu item.
|
| - void StopSpeaking();
|
| + // Helper method that returns the BiDi parameter value for |direction|.
|
| + int BiDiParamsForDirection(base::i18n::TextDirection direction) const;
|
|
|
| // The Cocoa menu controller for this menu.
|
| base::scoped_nsobject<MenuController> menu_controller_;
|
|
|
| - // Model for the "Speech" submenu.
|
| - ui::SimpleMenuModel speech_submenu_model_;
|
| -
|
| - // Model for the BiDi input submenu.
|
| - ui::SimpleMenuModel bidi_submenu_model_;
|
| -
|
| // The Cocoa parent view.
|
| NSView* parent_view_;
|
|
|
| + // The context menu that adds and handles Speech, Lookup and BiDi.
|
| + ui::TextServicesContextMenu text_services_context_menu_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenuMac);
|
| };
|
|
|
|
|