| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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.h" | 5 #include "remoting/host/input_injector.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/location.h" | 11 #include "base/location.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
| 14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 16 #include "remoting/base/logging.h" |
| 16 #include "remoting/base/util.h" | 17 #include "remoting/base/util.h" |
| 17 #include "remoting/host/clipboard.h" | 18 #include "remoting/host/clipboard.h" |
| 18 #include "remoting/proto/event.pb.h" | 19 #include "remoting/proto/event.pb.h" |
| 19 #include "ui/events/keycodes/dom4/keycode_converter.h" | 20 #include "ui/events/keycodes/dom4/keycode_converter.h" |
| 20 | 21 |
| 21 namespace remoting { | 22 namespace remoting { |
| 22 | 23 |
| 23 namespace { | 24 namespace { |
| 24 | 25 |
| 25 // Helper used to call SendInput() API. | 26 // Helper used to call SendInput() API. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE; | 64 virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE; |
| 64 | 65 |
| 65 // InputStub interface. | 66 // InputStub interface. |
| 66 virtual void InjectKeyEvent(const KeyEvent& event) OVERRIDE; | 67 virtual void InjectKeyEvent(const KeyEvent& event) OVERRIDE; |
| 67 virtual void InjectTextEvent(const TextEvent& event) OVERRIDE; | 68 virtual void InjectTextEvent(const TextEvent& event) OVERRIDE; |
| 68 virtual void InjectMouseEvent(const MouseEvent& event) OVERRIDE; | 69 virtual void InjectMouseEvent(const MouseEvent& event) OVERRIDE; |
| 69 | 70 |
| 70 // InputInjector interface. | 71 // InputInjector interface. |
| 71 virtual void Start( | 72 virtual void Start( |
| 72 scoped_ptr<protocol::ClipboardStub> client_clipboard) OVERRIDE; | 73 scoped_ptr<protocol::ClipboardStub> client_clipboard) OVERRIDE; |
| 74 void EnableWindowInjection(webrtc::WindowId window_id); |
| 73 | 75 |
| 74 private: | 76 private: |
| 75 // The actual implementation resides in InputInjectorWin::Core class. | 77 // The actual implementation resides in InputInjectorWin::Core class. |
| 76 class Core : public base::RefCountedThreadSafe<Core> { | 78 class Core : public base::RefCountedThreadSafe<Core> { |
| 77 public: | 79 public: |
| 78 Core(scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 80 Core(scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 79 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); | 81 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); |
| 80 | 82 |
| 81 // Mirrors the ClipboardStub interface. | 83 // Mirrors the ClipboardStub interface. |
| 82 void InjectClipboardEvent(const ClipboardEvent& event); | 84 void InjectClipboardEvent(const ClipboardEvent& event); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 137 |
| 136 void InputInjectorWin::InjectMouseEvent(const MouseEvent& event) { | 138 void InputInjectorWin::InjectMouseEvent(const MouseEvent& event) { |
| 137 core_->InjectMouseEvent(event); | 139 core_->InjectMouseEvent(event); |
| 138 } | 140 } |
| 139 | 141 |
| 140 void InputInjectorWin::Start( | 142 void InputInjectorWin::Start( |
| 141 scoped_ptr<protocol::ClipboardStub> client_clipboard) { | 143 scoped_ptr<protocol::ClipboardStub> client_clipboard) { |
| 142 core_->Start(client_clipboard.Pass()); | 144 core_->Start(client_clipboard.Pass()); |
| 143 } | 145 } |
| 144 | 146 |
| 147 void EnableWindowInjection(webrtc::WindowId window_id) { |
| 148 NOTIMPLEMENTED(); |
| 149 } |
| 150 |
| 145 InputInjectorWin::Core::Core( | 151 InputInjectorWin::Core::Core( |
| 146 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 152 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 147 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) | 153 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) |
| 148 : main_task_runner_(main_task_runner), | 154 : main_task_runner_(main_task_runner), |
| 149 ui_task_runner_(ui_task_runner), | 155 ui_task_runner_(ui_task_runner), |
| 150 clipboard_(Clipboard::Create()) { | 156 clipboard_(Clipboard::Create()) { |
| 151 } | 157 } |
| 152 | 158 |
| 153 void InputInjectorWin::Core::InjectClipboardEvent(const ClipboardEvent& event) { | 159 void InputInjectorWin::Core::InjectClipboardEvent(const ClipboardEvent& event) { |
| 154 if (!ui_task_runner_->BelongsToCurrentThread()) { | 160 if (!ui_task_runner_->BelongsToCurrentThread()) { |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 | 328 |
| 323 } // namespace | 329 } // namespace |
| 324 | 330 |
| 325 scoped_ptr<InputInjector> InputInjector::Create( | 331 scoped_ptr<InputInjector> InputInjector::Create( |
| 326 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 332 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 327 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { | 333 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { |
| 328 return scoped_ptr<InputInjector>( | 334 return scoped_ptr<InputInjector>( |
| 329 new InputInjectorWin(main_task_runner, ui_task_runner)); | 335 new InputInjectorWin(main_task_runner, ui_task_runner)); |
| 330 } | 336 } |
| 331 | 337 |
| 338 scoped_ptr<InputInjector> CreateForWindow( |
| 339 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 340 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
| 341 webrtc::WindowId windowId) { |
| 342 } |
| 343 |
| 332 } // namespace remoting | 344 } // namespace remoting |
| OLD | NEW |