Index: content/browser/renderer_host/render_widget_host_view_aura.cc |
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc |
index c5494d9976f4698c4ae8ed9592e4a49ad703fbb0..8bc0b2e5493ecfe8b9a8001b6b9609ac0324fd33 100644 |
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc |
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc |
@@ -2720,10 +2720,19 @@ void RenderWidgetHostViewAura::SnapToPhysicalPixelBoundary() { |
has_snapped_to_boundary_ = true; |
} |
-void RenderWidgetHostViewAura::OnShowContextMenu() { |
+bool RenderWidgetHostViewAura::OnShowContextMenu( |
+ const ContextMenuParams& params) { |
#if defined(OS_WIN) |
showing_context_menu_ = true; |
tdresser
2016/01/20 15:26:12
Should showing_context_menu_ be true in the case w
ananta
2016/01/21 02:08:53
Yeah. Good point. Moved it to after the if check
|
+ last_context_menu_params_.reset(); |
+ |
+ if (params.source_type == ui::MENU_SOURCE_TOUCH) { |
+ last_context_menu_params_.reset(new ContextMenuParams); |
+ *last_context_menu_params_ = params; |
+ return false; |
+ } |
#endif |
+ return true; |
} |
void RenderWidgetHostViewAura::SetSelectionControllerClientForTest( |
@@ -2931,17 +2940,51 @@ void RenderWidgetHostViewAura::HandleGestureForTouchSelection( |
} |
break; |
case ui::ET_GESTURE_SCROLL_BEGIN: |
- selection_controller_->OnScrollBeginEvent(); |
selection_controller_client_->OnScrollStarted(); |
break; |
case ui::ET_GESTURE_SCROLL_END: |
selection_controller_client_->OnScrollCompleted(); |
break; |
+#if defined(OS_WIN) |
+ case ui::ET_GESTURE_LONG_TAP: { |
+ if (!last_context_menu_params_) |
+ break; |
+ |
+ ContextMenuParams params = *last_context_menu_params_; |
tdresser
2016/01/20 15:26:12
You shouldn't need to copy the ContextMenuParams h
ananta
2016/01/21 02:08:53
Done.
|
+ DCHECK(params.source_type == ui::MENU_SOURCE_TOUCH); |
+ params.source_type = ui::MENU_SOURCE_MOUSE; |
tdresser
2016/01/20 15:26:12
It might be worth adding a comment here - settings
ananta
2016/01/21 02:08:53
Done.
|
+ |
+ last_context_menu_params_.reset(); |
+ |
+ RenderViewHostDelegateView* delegate_view = |
+ GetRenderViewHostDelegateView(); |
+ if (delegate_view) |
+ delegate_view->ShowContextMenu(GetFocusedFrame(), params); |
+ event->SetHandled(); |
+ // WARNING: we may have been deleted during the call to ShowContextMenu(). |
+ break; |
+ } |
+#endif |
default: |
break; |
} |
} |
+RenderViewHostDelegateView* |
+RenderWidgetHostViewAura::GetRenderViewHostDelegateView() { |
+ // Use RenderViewHostDelegate to get to the WebContentsViewAura, which will |
+ // actually show the disambiguation popup. |
+ RenderViewHost* rvh = RenderViewHost::From(host_); |
+ if (!rvh) |
+ return nullptr; |
+ |
+ RenderViewHostDelegate* delegate = rvh->GetDelegate(); |
+ if (!delegate) |
+ return nullptr; |
+ |
+ return delegate->GetDelegateView(); |
+} |
+ |
//////////////////////////////////////////////////////////////////////////////// |
// DelegatedFrameHost, public: |