| Index: chrome/browser/ui/cocoa/renderer_context_menu/render_view_context_menu_mac.mm
|
| diff --git a/chrome/browser/ui/cocoa/renderer_context_menu/render_view_context_menu_mac.mm b/chrome/browser/ui/cocoa/renderer_context_menu/render_view_context_menu_mac.mm
|
| index 21963a0703afdd4b764a4b8b8e079dd055ae283a..dfd5cd9b15ce8b7f08cae585e3c1a039cdd1573a 100644
|
| --- a/chrome/browser/ui/cocoa/renderer_context_menu/render_view_context_menu_mac.mm
|
| +++ b/chrome/browser/ui/cocoa/renderer_context_menu/render_view_context_menu_mac.mm
|
| @@ -183,9 +183,9 @@ RenderViewContextMenuMac::RenderViewContextMenuMac(
|
| const content::ContextMenuParams& params,
|
| NSView* parent_view)
|
| : RenderViewContextMenu(render_frame_host, params),
|
| - speech_submenu_model_(this),
|
| bidi_submenu_model_(this),
|
| - parent_view_(parent_view) {
|
| + parent_view_(parent_view),
|
| + text_context_menu_(new TextContextMenu(this)) {
|
| std::unique_ptr<ToolkitDelegate> delegate(new ToolkitDelegateMac(this));
|
| set_toolkit_delegate(std::move(delegate));
|
| }
|
| @@ -250,14 +250,6 @@ void RenderViewContextMenuMac::ExecuteCommand(int command_id, int event_flags) {
|
| LookUpInDictionary();
|
| break;
|
|
|
| - case IDC_CONTENT_CONTEXT_SPEECH_START_SPEAKING:
|
| - StartSpeaking();
|
| - break;
|
| -
|
| - case IDC_CONTENT_CONTEXT_SPEECH_STOP_SPEAKING:
|
| - StopSpeaking();
|
| - break;
|
| -
|
| case IDC_WRITING_DIRECTION_DEFAULT:
|
| // WebKit's current behavior is for this menu item to always be disabled.
|
| NOTREACHED();
|
| @@ -305,17 +297,6 @@ bool RenderViewContextMenuMac::IsCommandIdEnabled(int command_id) const {
|
| // appropriate.
|
| return true;
|
|
|
| - case IDC_CONTENT_CONTEXT_SPEECH_START_SPEAKING:
|
| - // This is OK because the menu is not shown when it isn't
|
| - // appropriate.
|
| - return true;
|
| -
|
| - case IDC_CONTENT_CONTEXT_SPEECH_STOP_SPEAKING: {
|
| - content::RenderWidgetHostView* view =
|
| - GetRenderViewHost()->GetWidget()->GetView();
|
| - return view && view->IsSpeaking();
|
| - }
|
| -
|
| case IDC_WRITING_DIRECTION_DEFAULT: // Provided to match OS defaults.
|
| return params_.writing_direction_default &
|
| blink::WebContextMenuData::CheckableMenuItemEnabled;
|
| @@ -373,21 +354,7 @@ void RenderViewContextMenuMac::InitToolkitMenu() {
|
| menu_model_.InsertSeparatorAt(index++, ui::NORMAL_SEPARATOR);
|
| }
|
|
|
| - content::RenderWidgetHostView* view =
|
| - GetRenderViewHost()->GetWidget()->GetView();
|
| - if (view && view->SupportsSpeech()) {
|
| - menu_model_.AddSeparator(ui::NORMAL_SEPARATOR);
|
| - speech_submenu_model_.AddItemWithStringId(
|
| - IDC_CONTENT_CONTEXT_SPEECH_START_SPEAKING,
|
| - IDS_SPEECH_START_SPEAKING_MAC);
|
| - speech_submenu_model_.AddItemWithStringId(
|
| - IDC_CONTENT_CONTEXT_SPEECH_STOP_SPEAKING,
|
| - IDS_SPEECH_STOP_SPEAKING_MAC);
|
| - menu_model_.AddSubMenu(
|
| - IDC_CONTENT_CONTEXT_SPEECH_MENU,
|
| - l10n_util::GetStringUTF16(IDS_SPEECH_MAC),
|
| - &speech_submenu_model_);
|
| - }
|
| + text_context_menu_->AppendToContextMenu(&menu_model_);
|
| }
|
|
|
| void RenderViewContextMenuMac::CancelToolkitMenu() {
|
| @@ -438,10 +405,3 @@ void RenderViewContextMenuMac::StartSpeaking() {
|
| if (view)
|
| view->SpeakSelection();
|
| }
|
| -
|
| -void RenderViewContextMenuMac::StopSpeaking() {
|
| - content::RenderWidgetHostView* view =
|
| - GetRenderViewHost()->GetWidget()->GetView();
|
| - if (view)
|
| - view->StopSpeaking();
|
| -}
|
|
|