Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: remoting/host/input_injector_chromeos.cc

Issue 932233002: Revert of Fix breaking change in It2me Host on Ozone (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 // display rotation settings. 67 // display rotation settings.
68 scoped_ptr<PointTransformer> point_transformer_; 68 scoped_ptr<PointTransformer> point_transformer_;
69 69
70 // Used by HandleAutoRepeat(). 70 // Used by HandleAutoRepeat().
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() : saved_auto_repeat_enabled_(false) { 77 InputInjectorChromeos::Core::Core(scoped_ptr<ui::SystemInputInjector> delegate,
78 ui::InputController* input_controller)
79 : delegate_(delegate.Pass()),
80 input_controller_(input_controller),
81 saved_auto_repeat_enabled_(false) {
82 DCHECK(delegate_);
83 DCHECK(input_controller_);
78 } 84 }
79 85
80 void InputInjectorChromeos::Core::InjectClipboardEvent( 86 void InputInjectorChromeos::Core::InjectClipboardEvent(
81 const ClipboardEvent& event) { 87 const ClipboardEvent& event) {
82 clipboard_->InjectClipboardEvent(event); 88 clipboard_->InjectClipboardEvent(event);
83 } 89 }
84 90
85 void InputInjectorChromeos::Core::InjectKeyEvent(const KeyEvent& event) { 91 void InputInjectorChromeos::Core::InjectKeyEvent(const KeyEvent& event) {
86 DCHECK(event.has_pressed()); 92 DCHECK(event.has_pressed());
87 DCHECK(event.has_usb_keycode()); 93 DCHECK(event.has_usb_keycode());
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 delegate_->InjectMouseWheel(event.wheel_delta_x(), event.wheel_delta_y()); 149 delegate_->InjectMouseWheel(event.wheel_delta_x(), event.wheel_delta_y());
144 } else { 150 } else {
145 DCHECK(event.has_x() && event.has_y()); 151 DCHECK(event.has_x() && event.has_y());
146 delegate_->MoveCursorTo(point_transformer_->ToScreenCoordinates( 152 delegate_->MoveCursorTo(point_transformer_->ToScreenCoordinates(
147 gfx::PointF(event.x(), event.y()))); 153 gfx::PointF(event.x(), event.y())));
148 } 154 }
149 } 155 }
150 156
151 void InputInjectorChromeos::Core::Start( 157 void InputInjectorChromeos::Core::Start(
152 scoped_ptr<protocol::ClipboardStub> client_clipboard) { 158 scoped_ptr<protocol::ClipboardStub> client_clipboard) {
153 ui::OzonePlatform* ozone_platform = ui::OzonePlatform::GetInstance();
154 delegate_ = ozone_platform->CreateSystemInputInjector();
155 DCHECK(delegate_);
156 input_controller_ = ozone_platform->GetInputController();
157 DCHECK(input_controller_);
158
159 // Implemented by remoting::ClipboardAura.
160 clipboard_ = Clipboard::Create(); 159 clipboard_ = Clipboard::Create();
161 clipboard_->Start(client_clipboard.Pass()); 160 clipboard_->Start(client_clipboard.Pass());
162 point_transformer_.reset(new PointTransformer()); 161 point_transformer_.reset(new PointTransformer());
163 } 162 }
164 163
165 InputInjectorChromeos::InputInjectorChromeos( 164 InputInjectorChromeos::InputInjectorChromeos(
166 scoped_refptr<base::SingleThreadTaskRunner> task_runner) 165 scoped_refptr<base::SingleThreadTaskRunner> task_runner)
167 : input_task_runner_(task_runner) { 166 : input_task_runner_(task_runner) {
168 core_.reset(new Core()); 167 ui::OzonePlatform* ozone_platform = ui::OzonePlatform::GetInstance();
168 core_.reset(new Core(ozone_platform->CreateSystemInputInjector(),
169 ozone_platform->GetInputController()));
169 } 170 }
170 171
171 InputInjectorChromeos::~InputInjectorChromeos() { 172 InputInjectorChromeos::~InputInjectorChromeos() {
172 input_task_runner_->DeleteSoon(FROM_HERE, core_.release()); 173 input_task_runner_->DeleteSoon(FROM_HERE, core_.release());
173 } 174 }
174 175
175 void InputInjectorChromeos::InjectClipboardEvent(const ClipboardEvent& event) { 176 void InputInjectorChromeos::InjectClipboardEvent(const ClipboardEvent& event) {
176 input_task_runner_->PostTask( 177 input_task_runner_->PostTask(
177 FROM_HERE, base::Bind(&Core::InjectClipboardEvent, 178 FROM_HERE, base::Bind(&Core::InjectClipboardEvent,
178 base::Unretained(core_.get()), event)); 179 base::Unretained(core_.get()), event));
(...skipping 27 matching lines...) Expand all
206 // static 207 // static
207 scoped_ptr<InputInjector> InputInjector::Create( 208 scoped_ptr<InputInjector> InputInjector::Create(
208 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, 209 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
209 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { 210 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) {
210 // 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
211 // browser process. 212 // browser process.
212 return make_scoped_ptr(new InputInjectorChromeos(ui_task_runner)); 213 return make_scoped_ptr(new InputInjectorChromeos(ui_task_runner));
213 } 214 }
214 215
215 } // namespace remoting 216 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698