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/local_input_monitor.h" | 5 #include "remoting/host/local_input_monitor.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/ptr_util.h" |
11 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
12 #include "base/threading/non_thread_safe.h" | 13 #include "base/threading/non_thread_safe.h" |
13 #include "remoting/host/chromeos/point_transformer.h" | 14 #include "remoting/host/chromeos/point_transformer.h" |
14 #include "remoting/host/client_session_control.h" | 15 #include "remoting/host/client_session_control.h" |
15 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" | 16 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" |
16 #include "ui/events/event.h" | 17 #include "ui/events/event.h" |
17 #include "ui/events/event_utils.h" | 18 #include "ui/events/event_utils.h" |
18 #include "ui/events/keycodes/keyboard_codes.h" | 19 #include "ui/events/keycodes/keyboard_codes.h" |
19 #include "ui/events/platform/platform_event_observer.h" | 20 #include "ui/events/platform/platform_event_observer.h" |
20 #include "ui/events/platform/platform_event_source.h" | 21 #include "ui/events/platform/platform_event_source.h" |
(...skipping 28 matching lines...) Expand all Loading... |
49 void HandleKeyPressed(const ui::PlatformEvent& event); | 50 void HandleKeyPressed(const ui::PlatformEvent& event); |
50 | 51 |
51 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_; | 52 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_; |
52 | 53 |
53 // Points to the object receiving mouse event notifications and session | 54 // Points to the object receiving mouse event notifications and session |
54 // disconnect requests. Must be called on the |caller_task_runner_|. | 55 // disconnect requests. Must be called on the |caller_task_runner_|. |
55 base::WeakPtr<ClientSessionControl> client_session_control_; | 56 base::WeakPtr<ClientSessionControl> client_session_control_; |
56 | 57 |
57 // Used to rotate the local mouse positions appropriately based on the | 58 // Used to rotate the local mouse positions appropriately based on the |
58 // current display rotation settings. | 59 // current display rotation settings. |
59 scoped_ptr<PointTransformer> point_transformer_; | 60 std::unique_ptr<PointTransformer> point_transformer_; |
60 | 61 |
61 DISALLOW_COPY_AND_ASSIGN(Core); | 62 DISALLOW_COPY_AND_ASSIGN(Core); |
62 }; | 63 }; |
63 | 64 |
64 // Task runner on which ui::events are received. | 65 // Task runner on which ui::events are received. |
65 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_; | 66 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_; |
66 scoped_ptr<Core> core_; | 67 std::unique_ptr<Core> core_; |
67 | 68 |
68 DISALLOW_COPY_AND_ASSIGN(LocalInputMonitorChromeos); | 69 DISALLOW_COPY_AND_ASSIGN(LocalInputMonitorChromeos); |
69 }; | 70 }; |
70 | 71 |
71 LocalInputMonitorChromeos::LocalInputMonitorChromeos( | 72 LocalInputMonitorChromeos::LocalInputMonitorChromeos( |
72 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 73 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
73 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 74 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
74 base::WeakPtr<ClientSessionControl> client_session_control) | 75 base::WeakPtr<ClientSessionControl> client_session_control) |
75 : input_task_runner_(input_task_runner), | 76 : input_task_runner_(input_task_runner), |
76 core_(new Core(caller_task_runner, client_session_control)) { | 77 core_(new Core(caller_task_runner, client_session_control)) { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 if (key_event.IsControlDown() && key_event.IsAltDown() && | 134 if (key_event.IsControlDown() && key_event.IsAltDown() && |
134 key_event.key_code() == ui::VKEY_ESCAPE) { | 135 key_event.key_code() == ui::VKEY_ESCAPE) { |
135 caller_task_runner_->PostTask( | 136 caller_task_runner_->PostTask( |
136 FROM_HERE, base::Bind(&ClientSessionControl::DisconnectSession, | 137 FROM_HERE, base::Bind(&ClientSessionControl::DisconnectSession, |
137 client_session_control_, protocol::OK)); | 138 client_session_control_, protocol::OK)); |
138 } | 139 } |
139 } | 140 } |
140 | 141 |
141 } // namespace | 142 } // namespace |
142 | 143 |
143 scoped_ptr<LocalInputMonitor> LocalInputMonitor::Create( | 144 std::unique_ptr<LocalInputMonitor> LocalInputMonitor::Create( |
144 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 145 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
145 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 146 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
146 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | 147 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
147 base::WeakPtr<ClientSessionControl> client_session_control) { | 148 base::WeakPtr<ClientSessionControl> client_session_control) { |
148 return make_scoped_ptr(new LocalInputMonitorChromeos( | 149 return base::WrapUnique(new LocalInputMonitorChromeos( |
149 caller_task_runner, input_task_runner, client_session_control)); | 150 caller_task_runner, input_task_runner, client_session_control)); |
150 } | 151 } |
151 | 152 |
152 } // namespace remoting | 153 } // namespace remoting |
OLD | NEW |