| 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/input_injector_chromeos.h" | 5 #include "remoting/host/input_injector_chromeos.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 std::set<ui::DomCode> pressed_keys_; | 71 std::set<ui::DomCode> pressed_keys_; |
| 72 bool saved_auto_repeat_enabled_; | 72 bool saved_auto_repeat_enabled_; |
| 73 | 73 |
| 74 DISALLOW_COPY_AND_ASSIGN(Core); | 74 DISALLOW_COPY_AND_ASSIGN(Core); |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 InputInjectorChromeos::Core::Core(scoped_ptr<ui::SystemInputInjector> delegate, | 77 InputInjectorChromeos::Core::Core(scoped_ptr<ui::SystemInputInjector> delegate, |
| 78 ui::InputController* input_controller) | 78 ui::InputController* input_controller) |
| 79 : delegate_(delegate.Pass()), | 79 : delegate_(delegate.Pass()), |
| 80 input_controller_(input_controller), | 80 input_controller_(input_controller), |
| 81 // Implemented by remoting::ClipboardAura. | |
| 82 clipboard_(Clipboard::Create()), | |
| 83 saved_auto_repeat_enabled_(false) { | 81 saved_auto_repeat_enabled_(false) { |
| 84 DCHECK(delegate_); | 82 DCHECK(delegate_); |
| 85 DCHECK(input_controller_); | 83 DCHECK(input_controller_); |
| 86 DCHECK(clipboard_); | |
| 87 } | 84 } |
| 88 | 85 |
| 89 void InputInjectorChromeos::Core::InjectClipboardEvent( | 86 void InputInjectorChromeos::Core::InjectClipboardEvent( |
| 90 const ClipboardEvent& event) { | 87 const ClipboardEvent& event) { |
| 91 clipboard_->InjectClipboardEvent(event); | 88 clipboard_->InjectClipboardEvent(event); |
| 92 } | 89 } |
| 93 | 90 |
| 94 void InputInjectorChromeos::Core::InjectKeyEvent(const KeyEvent& event) { | 91 void InputInjectorChromeos::Core::InjectKeyEvent(const KeyEvent& event) { |
| 95 DCHECK(event.has_pressed()); | 92 DCHECK(event.has_pressed()); |
| 96 DCHECK(event.has_usb_keycode()); | 93 DCHECK(event.has_usb_keycode()); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 delegate_->InjectMouseWheel(event.wheel_delta_x(), event.wheel_delta_y()); | 149 delegate_->InjectMouseWheel(event.wheel_delta_x(), event.wheel_delta_y()); |
| 153 } else { | 150 } else { |
| 154 DCHECK(event.has_x() && event.has_y()); | 151 DCHECK(event.has_x() && event.has_y()); |
| 155 delegate_->MoveCursorTo(point_transformer_->ToScreenCoordinates( | 152 delegate_->MoveCursorTo(point_transformer_->ToScreenCoordinates( |
| 156 gfx::PointF(event.x(), event.y()))); | 153 gfx::PointF(event.x(), event.y()))); |
| 157 } | 154 } |
| 158 } | 155 } |
| 159 | 156 |
| 160 void InputInjectorChromeos::Core::Start( | 157 void InputInjectorChromeos::Core::Start( |
| 161 scoped_ptr<protocol::ClipboardStub> client_clipboard) { | 158 scoped_ptr<protocol::ClipboardStub> client_clipboard) { |
| 159 clipboard_ = Clipboard::Create(); |
| 162 clipboard_->Start(client_clipboard.Pass()); | 160 clipboard_->Start(client_clipboard.Pass()); |
| 163 point_transformer_.reset(new PointTransformer()); | 161 point_transformer_.reset(new PointTransformer()); |
| 164 } | 162 } |
| 165 | 163 |
| 166 InputInjectorChromeos::InputInjectorChromeos( | 164 InputInjectorChromeos::InputInjectorChromeos( |
| 167 scoped_refptr<base::SingleThreadTaskRunner> task_runner) | 165 scoped_refptr<base::SingleThreadTaskRunner> task_runner) |
| 168 : input_task_runner_(task_runner) { | 166 : input_task_runner_(task_runner) { |
| 169 ui::OzonePlatform* ozone_platform = ui::OzonePlatform::GetInstance(); | 167 ui::OzonePlatform* ozone_platform = ui::OzonePlatform::GetInstance(); |
| 170 core_.reset(new Core(ozone_platform->CreateSystemInputInjector(), | 168 core_.reset(new Core(ozone_platform->CreateSystemInputInjector(), |
| 171 ozone_platform->GetInputController())); | 169 ozone_platform->GetInputController())); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 // static | 207 // static |
| 210 scoped_ptr<InputInjector> InputInjector::Create( | 208 scoped_ptr<InputInjector> InputInjector::Create( |
| 211 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 209 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
| 212 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { | 210 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { |
| 213 // The Ozone input injector must be called on the UI task runner of the | 211 // The Ozone input injector must be called on the UI task runner of the |
| 214 // browser process. | 212 // browser process. |
| 215 return make_scoped_ptr(new InputInjectorChromeos(ui_task_runner)); | 213 return make_scoped_ptr(new InputInjectorChromeos(ui_task_runner)); |
| 216 } | 214 } |
| 217 | 215 |
| 218 } // namespace remoting | 216 } // namespace remoting |
| OLD | NEW |