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

Side by Side 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: ditto Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_COCOA_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_M AC_H_ 5 #ifndef CHROME_BROWSER_UI_COCOA_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_M AC_H_
6 #define CHROME_BROWSER_UI_COCOA_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_M AC_H_ 6 #define CHROME_BROWSER_UI_COCOA_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_M AC_H_
7 7
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 9
10 #include "base/mac/scoped_nsobject.h" 10 #include "base/mac/scoped_nsobject.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" 12 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h"
13 #include "ui/base/cocoa/text_context_menu.h"
13 14
14 @class MenuController; 15 @class MenuController;
15 16
16 // Mac implementation of the context menu display code. Uses a Cocoa NSMenu 17 // Mac implementation of the context menu display code. Uses a Cocoa NSMenu
17 // to display the context menu. Internally uses an obj-c object as the 18 // to display the context menu. Internally uses an obj-c object as the
18 // target of the NSMenu, bridging back to this C++ class. 19 // target of the NSMenu, bridging back to this C++ class.
19 class RenderViewContextMenuMac : public RenderViewContextMenu { 20 class RenderViewContextMenuMac : public RenderViewContextMenu,
21 TextContextMenu::Delegate {
tapted 2016/07/22 03:06:42 public
spqchan 2016/12/12 19:32:27 Done.
20 public: 22 public:
21 RenderViewContextMenuMac(content::RenderFrameHost* render_frame_host, 23 RenderViewContextMenuMac(content::RenderFrameHost* render_frame_host,
22 const content::ContextMenuParams& params, 24 const content::ContextMenuParams& params,
23 NSView* parent_view); 25 NSView* parent_view);
24 ~RenderViewContextMenuMac() override; 26 ~RenderViewContextMenuMac() override;
25 27
26 // SimpleMenuModel::Delegate implementation. 28 // SimpleMenuModel::Delegate implementation.
27 void ExecuteCommand(int command_id, int event_flags) override; 29 void ExecuteCommand(int command_id, int event_flags) override;
28 bool IsCommandIdChecked(int command_id) const override; 30 bool IsCommandIdChecked(int command_id) const override;
29 bool IsCommandIdEnabled(int command_id) const override; 31 bool IsCommandIdEnabled(int command_id) const override;
(...skipping 22 matching lines...) Expand all
52 bool hidden, 54 bool hidden,
53 const base::string16& title); 55 const base::string16& title);
54 56
55 // Adds writing direction submenu. 57 // Adds writing direction submenu.
56 void AppendBidiSubMenu(); 58 void AppendBidiSubMenu();
57 59
58 // Handler for the "Look Up in Dictionary" menu item. 60 // Handler for the "Look Up in Dictionary" menu item.
59 void LookUpInDictionary(); 61 void LookUpInDictionary();
60 62
61 // Handler for the "Start Speaking" menu item. 63 // Handler for the "Start Speaking" menu item.
62 void StartSpeaking(); 64 void StartSpeaking() override;
63
64 // Handler for the "Stop Speaking" menu item.
65 void StopSpeaking();
66 65
67 // The Cocoa menu controller for this menu. 66 // The Cocoa menu controller for this menu.
68 base::scoped_nsobject<MenuController> menu_controller_; 67 base::scoped_nsobject<MenuController> menu_controller_;
69 68
70 // Model for the "Speech" submenu.
71 ui::SimpleMenuModel speech_submenu_model_;
72
73 // Model for the BiDi input submenu. 69 // Model for the BiDi input submenu.
74 ui::SimpleMenuModel bidi_submenu_model_; 70 ui::SimpleMenuModel bidi_submenu_model_;
75 71
76 // The Cocoa parent view. 72 // The Cocoa parent view.
77 NSView* parent_view_; 73 NSView* parent_view_;
78 74
75 std::unique_ptr<TextContextMenu> text_context_menu_;
tapted 2016/07/22 03:06:42 could this just be a value member? -- no need for
spqchan 2016/12/12 19:32:27 Done.
76
79 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenuMac); 77 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenuMac);
80 }; 78 };
81 79
82 // The ChromeSwizzleServicesMenuUpdater filters Services menu items in the 80 // The ChromeSwizzleServicesMenuUpdater filters Services menu items in the
83 // contextual menus and elsewhere using swizzling. 81 // contextual menus and elsewhere using swizzling.
84 @interface ChromeSwizzleServicesMenuUpdater : NSObject 82 @interface ChromeSwizzleServicesMenuUpdater : NSObject
85 // Return filtered entries, for testing. 83 // Return filtered entries, for testing.
86 + (void)storeFilteredEntriesForTestingInArray:(NSMutableArray*)array; 84 + (void)storeFilteredEntriesForTestingInArray:(NSMutableArray*)array;
87 @end 85 @end
88 86
89 #endif // CHROME_BROWSER_UI_COCOA_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MEN U_MAC_H_ 87 #endif // CHROME_BROWSER_UI_COCOA_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MEN U_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698