Chromium Code Reviews| Index: remoting/client/plugin/chromoting_instance.cc |
| diff --git a/remoting/client/plugin/chromoting_instance.cc b/remoting/client/plugin/chromoting_instance.cc |
| index ff8a06a1824a7631d82e06dffaeedb2f654d7092..a747e3eb26075c3c9f481907f250394e533543b8 100644 |
| --- a/remoting/client/plugin/chromoting_instance.cc |
| +++ b/remoting/client/plugin/chromoting_instance.cc |
| @@ -187,7 +187,8 @@ ChromotingInstance::ChromotingInstance(PP_Instance pp_instance) |
| plugin_task_runner_(new PluginThreadTaskRunner(&plugin_thread_delegate_)), |
| context_(plugin_task_runner_.get()), |
| input_tracker_(&mouse_input_filter_), |
| - key_mapper_(&input_tracker_), |
| + touch_input_scaler_(&input_tracker_), |
| + key_mapper_(&touch_input_scaler_), |
| cursor_setter_(this), |
| empty_cursor_filter_(&cursor_setter_), |
| text_input_controller_(this), |
| @@ -215,6 +216,7 @@ ChromotingInstance::ChromotingInstance(PP_Instance pp_instance) |
| #endif |
| // Register for mouse, wheel and keyboard events. |
| + // TODO(rkuroiwa): Add PP_INPUTEVENT_CLASS_TOUCH when ready. |
| RequestInputEvents(PP_INPUTEVENT_CLASS_MOUSE | PP_INPUTEVENT_CLASS_WHEEL); |
| RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_KEYBOARD); |
| @@ -350,6 +352,8 @@ void ChromotingInstance::HandleMessage(const pp::Var& message) { |
| HandleSendMouseInputWhenUnfocused(); |
| } else if (method == "delegateLargeCursors") { |
| HandleDelegateLargeCursors(); |
| + } else if (method == "sendTouchEvents") { |
|
Sergey Ulanov
2015/01/29 18:00:46
Why do we need this? Doesn't the plugin get touch
Sergey Ulanov
2015/01/29 18:06:46
Ah, so it just enables touch events. Call it enabl
Rintaro Kuroiwa
2015/01/30 17:57:01
Done.
|
| + HandleSendTouchEvents(); |
| } |
| } |
| @@ -368,8 +372,10 @@ void ChromotingInstance::DidChangeView(const pp::View& view) { |
| DCHECK(plugin_task_runner_->BelongsToCurrentThread()); |
| plugin_view_ = view; |
| - mouse_input_filter_.set_input_size( |
| + webrtc::DesktopSize size( |
| webrtc::DesktopSize(view.GetRect().width(), view.GetRect().height())); |
| + mouse_input_filter_.set_input_size(size); |
| + touch_input_scaler_.set_input_size(size); |
| if (video_renderer_) |
| video_renderer_->OnViewChanged(view); |
| @@ -401,8 +407,9 @@ void ChromotingInstance::OnVideoFirstFrameReceived() { |
| } |
| void ChromotingInstance::OnVideoSize(const webrtc::DesktopSize& size, |
| - const webrtc::DesktopVector& dpi) { |
| + const webrtc::DesktopVector& dpi) { |
| mouse_input_filter_.set_output_size(size); |
| + touch_input_scaler_.set_output_size(size); |
| scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); |
| data->SetInteger("width", size.width()); |
| @@ -664,9 +671,12 @@ void ChromotingInstance::HandleConnect(const base::DictionaryValue& data) { |
| // Connect the input pipeline to the protocol stub & initialize components. |
| mouse_input_filter_.set_input_stub(client_->input_stub()); |
| + touch_input_scaler_.set_input_stub(client_->input_stub()); |
| if (!plugin_view_.is_null()) { |
| - mouse_input_filter_.set_input_size(webrtc::DesktopSize( |
| - plugin_view_.GetRect().width(), plugin_view_.GetRect().height())); |
| + webrtc::DesktopSize size(plugin_view_.GetRect().width(), |
| + plugin_view_.GetRect().height()); |
| + mouse_input_filter_.set_input_size(size); |
| + touch_input_scaler_.set_input_size(size); |
| } |
| // Setup the signal strategy. |
| @@ -944,6 +954,10 @@ void ChromotingInstance::HandleDelegateLargeCursors() { |
| cursor_setter_.set_delegate_stub(this); |
| } |
| +void ChromotingInstance::HandleSendTouchEvents() { |
| + RequestInputEvents(PP_INPUTEVENT_CLASS_TOUCH); |
| +} |
| + |
| void ChromotingInstance::Disconnect() { |
| DCHECK(plugin_task_runner_->BelongsToCurrentThread()); |