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 a8ac8a6843dd732fa4af0ba4a819bb8421760f9f..db8dcd69334efbff03bcc2f9810993a0a678a444 100644 |
| --- a/content/browser/renderer_host/render_widget_host_impl.cc |
| +++ b/content/browser/renderer_host/render_widget_host_impl.cc |
| @@ -241,6 +241,9 @@ RenderWidgetHostImpl::RenderWidgetHostImpl(RenderWidgetHostDelegate* delegate, |
| base::Bind(&RenderWidgetHostImpl::ClearDisplayedGraphics, |
| weak_factory_.GetWeakPtr()))); |
| + for (size_t i = 0; i < arraysize(index_map_); ++i) |
| + index_map_[i] = -1; |
| + |
| delegate_->RenderWidgetCreated(this); |
| } |
| @@ -1700,12 +1703,63 @@ void RenderWidgetHostImpl::OnQueueSyntheticGesture( |
| return; |
| } |
| + if (gesture_packet.gesture_params()->GetGestureType() == |
| + SyntheticGestureParams::POINTER_ACTION) { |
| + QueueSyntheticPointerAction( |
| + *SyntheticPointerActionParams::Cast(gesture_packet.gesture_params())); |
| + return; |
| + } |
| + |
| QueueSyntheticGesture( |
| SyntheticGesture::Create(*gesture_packet.gesture_params()), |
| base::Bind(&RenderWidgetHostImpl::OnSyntheticGestureCompleted, |
| weak_factory_.GetWeakPtr())); |
| } |
| +void RenderWidgetHostImpl::QueueSyntheticPointerAction( |
|
tdresser
2016/04/18 15:24:39
We'd prefer to have this logic encapsulated within
lanwei
2016/04/19 19:05:32
No, you are right, I will move this part related t
|
| + const SyntheticPointerActionParams& gesture_params) { |
| + if (gesture_params.pointer_action_type() == |
| + SyntheticPointerActionParams::PointerActionType::PROCESS) { |
| + if (!synthetic_gesture_controller_ && view_) { |
| + synthetic_gesture_controller_.reset(new SyntheticGestureController( |
| + view_->CreateSyntheticGestureTarget())); |
| + } |
| + if (synthetic_gesture_controller_) { |
| + // Todo(lanwei@): Should check if type is pointer, make sure |
| + // synthetic_pointer_ is not null. |
| + DCHECK(gesture_params.pointer_action_type() != |
| + SyntheticPointerActionParams::PointerActionType::NOT_INITIALIZED); |
| + |
| + if (!synthetic_pointer_) |
| + SetSyntheticPointer(gesture_params); |
| + |
| + QueueSyntheticGesture( |
| + std::unique_ptr<SyntheticGesture>(new SyntheticPointerAction( |
| + action_param_list_, synthetic_pointer_.get(), index_map_)), |
| + base::Bind(&RenderWidgetHostImpl::OnSyntheticPointerActionCompleted, |
| + weak_factory_.GetWeakPtr())); |
| + } |
| + action_param_list_.clear(); |
| + return; |
| + } |
| + |
| + action_param_list_.push_back(gesture_params); |
| +} |
| + |
| +void RenderWidgetHostImpl::SetSyntheticPointer( |
| + const SyntheticPointerActionParams& gesture_params) { |
| + SyntheticGestureParams::GestureSourceType gesture_source_type = |
| + gesture_params.gesture_source_type; |
| + if (gesture_source_type == SyntheticGestureParams::DEFAULT_INPUT) { |
| + if (synthetic_gesture_controller_) { |
| + gesture_source_type = |
| + synthetic_gesture_controller_->GetDefaultSyntheticGestureSourceType(); |
| + DCHECK_NE(gesture_source_type, SyntheticGestureParams::DEFAULT_INPUT); |
| + synthetic_pointer_ = SyntheticPointer::Create(gesture_source_type); |
| + } |
| + } |
| +} |
| + |
| void RenderWidgetHostImpl::OnSetCursor(const WebCursor& cursor) { |
| SetCursor(cursor); |
| } |
| @@ -1962,6 +2016,13 @@ void RenderWidgetHostImpl::OnUnexpectedEventAck(UnexpectedEventAckType type) { |
| void RenderWidgetHostImpl::OnSyntheticGestureCompleted( |
| SyntheticGesture::Result result) { |
| Send(new InputMsg_SyntheticGestureCompleted(GetRoutingID())); |
| + synthetic_pointer_.reset(nullptr); |
| + ; |
| +} |
| + |
| +void RenderWidgetHostImpl::OnSyntheticPointerActionCompleted( |
| + SyntheticGesture::Result result) { |
| + // Do nothing |
| } |
| bool RenderWidgetHostImpl::ShouldDropInputEvents() const { |