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/desktop_session_agent.h" | 5 #include "remoting/host/desktop_session_agent.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ipc/ipc_channel_proxy.h" | 8 #include "ipc/ipc_channel_proxy.h" |
9 #include "ipc/ipc_message.h" | 9 #include "ipc/ipc_message.h" |
10 #include "ipc/ipc_message_macros.h" | 10 #include "ipc/ipc_message_macros.h" |
11 #include "remoting/base/auto_thread_task_runner.h" | 11 #include "remoting/base/auto_thread_task_runner.h" |
12 #include "remoting/base/capture_data.h" | |
13 #include "remoting/base/constants.h" | 12 #include "remoting/base/constants.h" |
14 #include "remoting/base/util.h" | 13 #include "remoting/base/util.h" |
| 14 #include "remoting/capturer/capture_data.h" |
15 #include "remoting/host/chromoting_messages.h" | 15 #include "remoting/host/chromoting_messages.h" |
16 #include "remoting/host/event_executor.h" | 16 #include "remoting/host/event_executor.h" |
17 #include "remoting/proto/control.pb.h" | 17 #include "remoting/proto/control.pb.h" |
18 #include "remoting/proto/event.pb.h" | 18 #include "remoting/proto/event.pb.h" |
19 #include "remoting/protocol/clipboard_stub.h" | 19 #include "remoting/protocol/clipboard_stub.h" |
20 #include "third_party/skia/include/core/SkRegion.h" | 20 #include "third_party/skia/include/core/SkRegion.h" |
21 | 21 |
22 namespace remoting { | 22 namespace remoting { |
23 | 23 |
24 namespace { | 24 namespace { |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 capture_data->client_sequence_number(); | 157 capture_data->client_sequence_number(); |
158 serialized_data.dpi = capture_data->dpi(); | 158 serialized_data.dpi = capture_data->dpi(); |
159 for (SkRegion::Iterator i(capture_data->dirty_region()); !i.done(); i.next()) | 159 for (SkRegion::Iterator i(capture_data->dirty_region()); !i.done(); i.next()) |
160 serialized_data.dirty_region.push_back(i.rect()); | 160 serialized_data.dirty_region.push_back(i.rect()); |
161 | 161 |
162 SendToNetwork( | 162 SendToNetwork( |
163 new ChromotingDesktopNetworkMsg_CaptureCompleted(serialized_data)); | 163 new ChromotingDesktopNetworkMsg_CaptureCompleted(serialized_data)); |
164 } | 164 } |
165 | 165 |
166 void DesktopSessionAgent::OnCursorShapeChanged( | 166 void DesktopSessionAgent::OnCursorShapeChanged( |
167 scoped_ptr<protocol::CursorShapeInfo> cursor_shape) { | 167 scoped_ptr<MouseCursorShape> cursor_shape) { |
168 DCHECK(video_capture_task_runner()->BelongsToCurrentThread()); | 168 DCHECK(video_capture_task_runner()->BelongsToCurrentThread()); |
169 | 169 |
170 // Serialize |cursor_shape| to a string. | |
171 std::string serialized_cursor_shape; | |
172 if (!cursor_shape->SerializeToString(&serialized_cursor_shape)) { | |
173 LOG(ERROR) << "Failed to serialize protocol::CursorShapeInfo."; | |
174 return; | |
175 } | |
176 | |
177 SendToNetwork(new ChromotingDesktopNetworkMsg_CursorShapeChanged( | 170 SendToNetwork(new ChromotingDesktopNetworkMsg_CursorShapeChanged( |
178 serialized_cursor_shape)); | 171 *cursor_shape)); |
179 } | 172 } |
180 | 173 |
181 void DesktopSessionAgent::InjectClipboardEvent( | 174 void DesktopSessionAgent::InjectClipboardEvent( |
182 const protocol::ClipboardEvent& event) { | 175 const protocol::ClipboardEvent& event) { |
183 DCHECK(caller_task_runner()->BelongsToCurrentThread()); | 176 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
184 | 177 |
185 std::string serialized_event; | 178 std::string serialized_event; |
186 if (!event.SerializeToString(&serialized_event)) { | 179 if (!event.SerializeToString(&serialized_event)) { |
187 LOG(ERROR) << "Failed to serialize protocol::ClipboardEvent."; | 180 LOG(ERROR) << "Failed to serialize protocol::ClipboardEvent."; |
188 return; | 181 return; |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner) | 396 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner) |
404 : caller_task_runner_(caller_task_runner), | 397 : caller_task_runner_(caller_task_runner), |
405 input_task_runner_(input_task_runner), | 398 input_task_runner_(input_task_runner), |
406 io_task_runner_(io_task_runner), | 399 io_task_runner_(io_task_runner), |
407 video_capture_task_runner_(video_capture_task_runner), | 400 video_capture_task_runner_(video_capture_task_runner), |
408 next_shared_buffer_id_(1) { | 401 next_shared_buffer_id_(1) { |
409 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 402 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
410 } | 403 } |
411 | 404 |
412 } // namespace remoting | 405 } // namespace remoting |
OLD | NEW |