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" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
66 | 66 |
67 // InputStub interface. | 67 // InputStub interface. |
68 virtual void InjectKeyEvent(const KeyEvent& event) override; | 68 virtual void InjectKeyEvent(const KeyEvent& event) override; |
69 virtual void InjectTextEvent(const TextEvent& event) override; | 69 virtual void InjectTextEvent(const TextEvent& event) override; |
70 virtual void InjectMouseEvent(const MouseEvent& event) override; | 70 virtual void InjectMouseEvent(const MouseEvent& event) override; |
71 virtual void InjectTouchEvent(const TouchEvent& event) override; | 71 virtual void InjectTouchEvent(const TouchEvent& event) override; |
72 | 72 |
73 // InputInjector interface. | 73 // InputInjector interface. |
74 virtual void Start( | 74 virtual void Start( |
75 scoped_ptr<protocol::ClipboardStub> client_clipboard) override; | 75 scoped_ptr<protocol::ClipboardStub> client_clipboard) override; |
76 virtual bool CanInjectTouch() override; | |
Wez
2015/04/09 22:58:59
This file will need the virtuals stripping out of
Rintaro Kuroiwa
2015/04/20 18:20:03
Done.
| |
76 | 77 |
77 private: | 78 private: |
78 // The actual implementation resides in InputInjectorWin::Core class. | 79 // The actual implementation resides in InputInjectorWin::Core class. |
79 class Core : public base::RefCountedThreadSafe<Core> { | 80 class Core : public base::RefCountedThreadSafe<Core> { |
80 public: | 81 public: |
81 Core(scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 82 Core(scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
82 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); | 83 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); |
83 | 84 |
84 // Mirrors the ClipboardStub interface. | 85 // Mirrors the ClipboardStub interface. |
85 void InjectClipboardEvent(const ClipboardEvent& event); | 86 void InjectClipboardEvent(const ClipboardEvent& event); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
145 | 146 |
146 void InputInjectorWin::InjectTouchEvent(const TouchEvent& event) { | 147 void InputInjectorWin::InjectTouchEvent(const TouchEvent& event) { |
147 core_->InjectTouchEvent(event); | 148 core_->InjectTouchEvent(event); |
148 } | 149 } |
149 | 150 |
150 void InputInjectorWin::Start( | 151 void InputInjectorWin::Start( |
151 scoped_ptr<protocol::ClipboardStub> client_clipboard) { | 152 scoped_ptr<protocol::ClipboardStub> client_clipboard) { |
152 core_->Start(client_clipboard.Pass()); | 153 core_->Start(client_clipboard.Pass()); |
153 } | 154 } |
154 | 155 |
156 bool InputInjectorWin::CanInjectTouch() { | |
157 return InputInjector::DefaultCanInjectTouch(); | |
158 } | |
159 | |
155 InputInjectorWin::Core::Core( | 160 InputInjectorWin::Core::Core( |
156 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 161 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
157 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) | 162 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) |
158 : main_task_runner_(main_task_runner), | 163 : main_task_runner_(main_task_runner), |
159 ui_task_runner_(ui_task_runner), | 164 ui_task_runner_(ui_task_runner), |
160 clipboard_(Clipboard::Create()) { | 165 clipboard_(Clipboard::Create()) { |
161 } | 166 } |
162 | 167 |
163 void InputInjectorWin::Core::InjectClipboardEvent(const ClipboardEvent& event) { | 168 void InputInjectorWin::Core::InjectClipboardEvent(const ClipboardEvent& event) { |
164 if (!ui_task_runner_->BelongsToCurrentThread()) { | 169 if (!ui_task_runner_->BelongsToCurrentThread()) { |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
348 | 353 |
349 } // namespace | 354 } // namespace |
350 | 355 |
351 scoped_ptr<InputInjector> InputInjector::Create( | 356 scoped_ptr<InputInjector> InputInjector::Create( |
352 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 357 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
353 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { | 358 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { |
354 return make_scoped_ptr( | 359 return make_scoped_ptr( |
355 new InputInjectorWin(main_task_runner, ui_task_runner)); | 360 new InputInjectorWin(main_task_runner, ui_task_runner)); |
356 } | 361 } |
357 | 362 |
363 // static | |
364 bool InputInjector::DefaultCanInjectTouch() { | |
365 return TouchInjectorWinDelegate::Create(); | |
366 } | |
367 | |
358 } // namespace remoting | 368 } // namespace remoting |
OLD | NEW |