| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "remoting/host/local_input_monitor.h" | 5 #include "remoting/host/local_input_monitor.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| 11 #include "base/threading/non_thread_safe.h" | 11 #include "base/threading/non_thread_safe.h" |
| 12 #include "remoting/host/chromeos/display_transform_util.h" |
| 12 #include "remoting/host/client_session_control.h" | 13 #include "remoting/host/client_session_control.h" |
| 13 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" | 14 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" |
| 14 #include "ui/events/event.h" | 15 #include "ui/events/event.h" |
| 15 #include "ui/events/event_utils.h" | 16 #include "ui/events/event_utils.h" |
| 16 #include "ui/events/keycodes/keyboard_codes.h" | 17 #include "ui/events/keycodes/keyboard_codes.h" |
| 17 #include "ui/events/platform/platform_event_observer.h" | 18 #include "ui/events/platform/platform_event_observer.h" |
| 18 #include "ui/events/platform/platform_event_source.h" | 19 #include "ui/events/platform/platform_event_source.h" |
| 19 | 20 |
| 20 namespace remoting { | 21 namespace remoting { |
| 21 | 22 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 ui::EventType type = ui::EventTypeFromNative(event); | 103 ui::EventType type = ui::EventTypeFromNative(event); |
| 103 if (type == ui::ET_MOUSE_MOVED) { | 104 if (type == ui::ET_MOUSE_MOVED) { |
| 104 HandleMouseMove(event); | 105 HandleMouseMove(event); |
| 105 } else if (type == ui::ET_KEY_PRESSED) { | 106 } else if (type == ui::ET_KEY_PRESSED) { |
| 106 HandleKeyPressed(event); | 107 HandleKeyPressed(event); |
| 107 } | 108 } |
| 108 } | 109 } |
| 109 | 110 |
| 110 void LocalInputMonitorChromeos::Core::HandleMouseMove( | 111 void LocalInputMonitorChromeos::Core::HandleMouseMove( |
| 111 const ui::PlatformEvent& event) { | 112 const ui::PlatformEvent& event) { |
| 112 gfx::Point mouse_position = ui::EventLocationFromNative(event); | 113 gfx::PointF mouse_position = ui::EventLocationFromNative(event); |
| 114 mouse_position = ConvertPointFromNativeScreen(mouse_position); |
| 115 |
| 113 caller_task_runner_->PostTask( | 116 caller_task_runner_->PostTask( |
| 114 FROM_HERE, | 117 FROM_HERE, |
| 115 base::Bind( | 118 base::Bind( |
| 116 &ClientSessionControl::OnLocalMouseMoved, client_session_control_, | 119 &ClientSessionControl::OnLocalMouseMoved, client_session_control_, |
| 117 webrtc::DesktopVector(mouse_position.x(), mouse_position.y()))); | 120 webrtc::DesktopVector(mouse_position.x(), mouse_position.y()))); |
| 118 } | 121 } |
| 119 | 122 |
| 120 void LocalInputMonitorChromeos::Core::HandleKeyPressed( | 123 void LocalInputMonitorChromeos::Core::HandleKeyPressed( |
| 121 const ui::PlatformEvent& event) { | 124 const ui::PlatformEvent& event) { |
| 122 ui::KeyEvent key_event(event); | 125 ui::KeyEvent key_event(event); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 134 scoped_ptr<LocalInputMonitor> LocalInputMonitor::Create( | 137 scoped_ptr<LocalInputMonitor> LocalInputMonitor::Create( |
| 135 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 138 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
| 136 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 139 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
| 137 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | 140 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
| 138 base::WeakPtr<ClientSessionControl> client_session_control) { | 141 base::WeakPtr<ClientSessionControl> client_session_control) { |
| 139 return make_scoped_ptr(new LocalInputMonitorChromeos( | 142 return make_scoped_ptr(new LocalInputMonitorChromeos( |
| 140 caller_task_runner, input_task_runner, client_session_control)); | 143 caller_task_runner, input_task_runner, client_session_control)); |
| 141 } | 144 } |
| 142 | 145 |
| 143 } // namespace remoting | 146 } // namespace remoting |
| OLD | NEW |