Chromium Code Reviews| Index: content/browser/renderer_host/render_widget_host_impl.cc |
| diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc |
| index fde38b4ccd86bfdf1b97442ac82f4ee70f496363..442c8b5bed89e30e66f0779279f4cb5380b6f2bc 100644 |
| --- a/content/browser/renderer_host/render_widget_host_impl.cc |
| +++ b/content/browser/renderer_host/render_widget_host_impl.cc |
| @@ -1184,10 +1184,7 @@ void RenderWidgetHostImpl::ForwardKeyboardEvent( |
| void RenderWidgetHostImpl::QueueSyntheticGesture( |
| std::unique_ptr<SyntheticGesture> synthetic_gesture, |
| const base::Callback<void(SyntheticGesture::Result)>& on_complete) { |
| - if (!synthetic_gesture_controller_ && view_) { |
| - synthetic_gesture_controller_.reset( |
| - new SyntheticGestureController(view_->CreateSyntheticGestureTarget())); |
| - } |
| + SetSyntheticGestureController(); |
|
tdresser
2016/10/26 18:28:40
We call SetSyntheticGestureController before we ev
lanwei
2016/10/30 23:23:13
Yes, there are some other places which also call t
|
| if (synthetic_gesture_controller_) { |
| synthetic_gesture_controller_->QueueSyntheticGesture( |
| std::move(synthetic_gesture), on_complete); |
| @@ -1746,10 +1743,23 @@ void RenderWidgetHostImpl::OnQueueSyntheticGesture( |
| return; |
| } |
| + SetSyntheticGestureController(); |
| + std::unique_ptr<SyntheticGesture> synthetic_gesture; |
| + const SyntheticGestureParams* gesture_params = |
| + gesture_packet.gesture_params(); |
| + if (gesture_params->GetGestureType() == |
| + SyntheticGestureParams::POINTER_ACTION_LIST) { |
| + synthetic_gesture = |
| + synthetic_gesture_controller_->CreateSyntheticPointerAction( |
| + *SyntheticPointerActionListParams::Cast(gesture_params)); |
| + } else { |
| + synthetic_gesture = SyntheticGesture::Create(*gesture_params); |
| + } |
| + |
| QueueSyntheticGesture( |
| - SyntheticGesture::Create(*gesture_packet.gesture_params()), |
| - base::Bind(&RenderWidgetHostImpl::OnSyntheticGestureCompleted, |
| - weak_factory_.GetWeakPtr())); |
| + std::move(synthetic_gesture), |
| + base::Bind(&RenderWidgetHostImpl::OnSyntheticGestureCompleted, |
| + weak_factory_.GetWeakPtr())); |
| } |
| void RenderWidgetHostImpl::OnSetCursor(const WebCursor& cursor) { |
| @@ -2192,6 +2202,14 @@ void RenderWidgetHostImpl::OnSnapshotDataReceivedAsync( |
| OnSnapshotDataReceived(snapshot_id, NULL, 0); |
| } |
| +void RenderWidgetHostImpl::SetSyntheticGestureController() { |
|
tdresser
2016/10/26 18:28:40
This method is confusing. Should it be called Crea
lanwei
2016/10/30 23:23:13
Done.
|
| + if (synthetic_gesture_controller_ || !view_) |
| + return; |
| + |
| + synthetic_gesture_controller_.reset( |
| + new SyntheticGestureController(view_->CreateSyntheticGestureTarget())); |
| +} |
| + |
| // static |
| void RenderWidgetHostImpl::CompositorFrameDrawn( |
| const std::vector<ui::LatencyInfo>& latency_info) { |