Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(249)

Unified Diff: chrome/browser/ui/cocoa/renderer_context_menu/render_view_context_menu_mac.h

Issue 2164483006: [MacViews] Implemented text context menu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix for tapted Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..64e97d7999f7ecb52d941a341d9f92c94f404305 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,13 +10,15 @@
#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,
@@ -28,13 +30,20 @@ class RenderViewContextMenuMac : public RenderViewContextMenu {
bool IsCommandIdChecked(int command_id) const override;
bool IsCommandIdEnabled(int command_id) const override;
+ // TextServicesContextMenu:
tapted 2016/12/16 07:01:19 nit: TextServicesContextMenu::Delegate:
spqchan 2016/12/17 00:34:21 Done.
+ base::string16 GetSelectedText() const override;
+ void OnSpeakRequested() override;
+ bool IsLookUpAvailable() const override;
+ void LookUpInDictionary() override;
+ bool IsTextDirectionEnabled(
+ base::i18n::TextDirection direction) const override;
+ bool IsTextDirectionChecked(
+ base::i18n::TextDirection direction) const override;
+ void UpdateTextDirection(base::i18n::TextDirection direction) override;
+
// RenderViewContextMenuBase implementation.
void Show() override;
- protected:
- // RenderViewContextMenu implementation.
- void AppendPlatformEditableItems() override;
-
private:
friend class ToolkitDelegateMac;
@@ -50,30 +59,15 @@ 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.
- 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.
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);
};

Powered by Google App Engine
This is Rietveld 408576698