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

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

Issue 1864213002: Convert //remoting to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac IWYU Created 4 years, 8 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 | « remoting/host/input_injector_chromeos.h ('k') | remoting/host/input_injector_mac.cc » ('j') | 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 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
12 #include "base/location.h" 12 #include "base/location.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ptr_util.h"
14 #include "remoting/host/chromeos/point_transformer.h" 15 #include "remoting/host/chromeos/point_transformer.h"
15 #include "remoting/host/clipboard.h" 16 #include "remoting/host/clipboard.h"
16 #include "remoting/proto/internal.pb.h" 17 #include "remoting/proto/internal.pb.h"
17 #include "ui/events/keycodes/dom/dom_code.h" 18 #include "ui/events/keycodes/dom/dom_code.h"
18 #include "ui/events/keycodes/dom/keycode_converter.h" 19 #include "ui/events/keycodes/dom/keycode_converter.h"
19 #include "ui/ozone/public/input_controller.h" 20 #include "ui/ozone/public/input_controller.h"
20 #include "ui/ozone/public/ozone_platform.h" 21 #include "ui/ozone/public/ozone_platform.h"
21 #include "ui/ozone/public/system_input_injector.h" 22 #include "ui/ozone/public/system_input_injector.h"
22 23
23 namespace remoting { 24 namespace remoting {
(...skipping 25 matching lines...) Expand all
49 // This class is run exclusively on the UI thread of the browser process. 50 // This class is run exclusively on the UI thread of the browser process.
50 class InputInjectorChromeos::Core { 51 class InputInjectorChromeos::Core {
51 public: 52 public:
52 Core(); 53 Core();
53 54
54 // Mirrors the public InputInjectorChromeos interface. 55 // Mirrors the public InputInjectorChromeos interface.
55 void InjectClipboardEvent(const ClipboardEvent& event); 56 void InjectClipboardEvent(const ClipboardEvent& event);
56 void InjectKeyEvent(const KeyEvent& event); 57 void InjectKeyEvent(const KeyEvent& event);
57 void InjectTextEvent(const TextEvent& event); 58 void InjectTextEvent(const TextEvent& event);
58 void InjectMouseEvent(const MouseEvent& event); 59 void InjectMouseEvent(const MouseEvent& event);
59 void Start(scoped_ptr<protocol::ClipboardStub> client_clipboard); 60 void Start(std::unique_ptr<protocol::ClipboardStub> client_clipboard);
60 61
61 private: 62 private:
62 scoped_ptr<ui::SystemInputInjector> delegate_; 63 std::unique_ptr<ui::SystemInputInjector> delegate_;
63 scoped_ptr<Clipboard> clipboard_; 64 std::unique_ptr<Clipboard> clipboard_;
64 65
65 // Used to rotate the input coordinates appropriately based on the current 66 // Used to rotate the input coordinates appropriately based on the current
66 // display rotation settings. 67 // display rotation settings.
67 scoped_ptr<PointTransformer> point_transformer_; 68 std::unique_ptr<PointTransformer> point_transformer_;
68 69
69 DISALLOW_COPY_AND_ASSIGN(Core); 70 DISALLOW_COPY_AND_ASSIGN(Core);
70 }; 71 };
71 72
72 InputInjectorChromeos::Core::Core() { 73 InputInjectorChromeos::Core::Core() {
73 } 74 }
74 75
75 void InputInjectorChromeos::Core::InjectClipboardEvent( 76 void InputInjectorChromeos::Core::InjectClipboardEvent(
76 const ClipboardEvent& event) { 77 const ClipboardEvent& event) {
77 clipboard_->InjectClipboardEvent(event); 78 clipboard_->InjectClipboardEvent(event);
(...skipping 26 matching lines...) Expand all
104 } else if (event.has_wheel_delta_y() || event.has_wheel_delta_x()) { 105 } else if (event.has_wheel_delta_y() || event.has_wheel_delta_x()) {
105 delegate_->InjectMouseWheel(event.wheel_delta_x(), event.wheel_delta_y()); 106 delegate_->InjectMouseWheel(event.wheel_delta_x(), event.wheel_delta_y());
106 } else { 107 } else {
107 DCHECK(event.has_x() && event.has_y()); 108 DCHECK(event.has_x() && event.has_y());
108 delegate_->MoveCursorTo(point_transformer_->ToScreenCoordinates( 109 delegate_->MoveCursorTo(point_transformer_->ToScreenCoordinates(
109 gfx::PointF(event.x(), event.y()))); 110 gfx::PointF(event.x(), event.y())));
110 } 111 }
111 } 112 }
112 113
113 void InputInjectorChromeos::Core::Start( 114 void InputInjectorChromeos::Core::Start(
114 scoped_ptr<protocol::ClipboardStub> client_clipboard) { 115 std::unique_ptr<protocol::ClipboardStub> client_clipboard) {
115 ui::OzonePlatform* ozone_platform = ui::OzonePlatform::GetInstance(); 116 ui::OzonePlatform* ozone_platform = ui::OzonePlatform::GetInstance();
116 delegate_ = ozone_platform->CreateSystemInputInjector(); 117 delegate_ = ozone_platform->CreateSystemInputInjector();
117 DCHECK(delegate_); 118 DCHECK(delegate_);
118 119
119 // Implemented by remoting::ClipboardAura. 120 // Implemented by remoting::ClipboardAura.
120 clipboard_ = Clipboard::Create(); 121 clipboard_ = Clipboard::Create();
121 clipboard_->Start(std::move(client_clipboard)); 122 clipboard_->Start(std::move(client_clipboard));
122 point_transformer_.reset(new PointTransformer()); 123 point_transformer_.reset(new PointTransformer());
123 } 124 }
124 125
(...skipping 29 matching lines...) Expand all
154 input_task_runner_->PostTask( 155 input_task_runner_->PostTask(
155 FROM_HERE, base::Bind(&Core::InjectMouseEvent, 156 FROM_HERE, base::Bind(&Core::InjectMouseEvent,
156 base::Unretained(core_.get()), event)); 157 base::Unretained(core_.get()), event));
157 } 158 }
158 159
159 void InputInjectorChromeos::InjectTouchEvent(const TouchEvent& event) { 160 void InputInjectorChromeos::InjectTouchEvent(const TouchEvent& event) {
160 NOTIMPLEMENTED() << "Raw touch event injection not implemented for ChromeOS."; 161 NOTIMPLEMENTED() << "Raw touch event injection not implemented for ChromeOS.";
161 } 162 }
162 163
163 void InputInjectorChromeos::Start( 164 void InputInjectorChromeos::Start(
164 scoped_ptr<protocol::ClipboardStub> client_clipboard) { 165 std::unique_ptr<protocol::ClipboardStub> client_clipboard) {
165 input_task_runner_->PostTask( 166 input_task_runner_->PostTask(
166 FROM_HERE, base::Bind(&Core::Start, base::Unretained(core_.get()), 167 FROM_HERE, base::Bind(&Core::Start, base::Unretained(core_.get()),
167 base::Passed(&client_clipboard))); 168 base::Passed(&client_clipboard)));
168 } 169 }
169 170
170 // static 171 // static
171 scoped_ptr<InputInjector> InputInjector::Create( 172 std::unique_ptr<InputInjector> InputInjector::Create(
172 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, 173 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
173 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { 174 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) {
174 // The Ozone input injector must be called on the UI task runner of the 175 // The Ozone input injector must be called on the UI task runner of the
175 // browser process. 176 // browser process.
176 return make_scoped_ptr(new InputInjectorChromeos(ui_task_runner)); 177 return base::WrapUnique(new InputInjectorChromeos(ui_task_runner));
177 } 178 }
178 179
179 // static 180 // static
180 bool InputInjector::SupportsTouchEvents() { 181 bool InputInjector::SupportsTouchEvents() {
181 return false; 182 return false;
182 } 183 }
183 184
184 } // namespace remoting 185 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/input_injector_chromeos.h ('k') | remoting/host/input_injector_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698