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

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: rebased Created 3 years, 10 months 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..5cebb5c79b4748310bd7888be6c2336943293bea 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();
+ // Returns value of the context menu parameter associated with |direction|.
+ int ParamsForTextDirection(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);
};
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/ui/cocoa/renderer_context_menu/render_view_context_menu_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698