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

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

Issue 11447021: Added support of Secure Attention Sequence in multiprocess mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 | Annotate | Revision Log
OLDNEW
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"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 DesktopSesssionClipboardStub::~DesktopSesssionClipboardStub() { 53 DesktopSesssionClipboardStub::~DesktopSesssionClipboardStub() {
54 } 54 }
55 55
56 void DesktopSesssionClipboardStub::InjectClipboardEvent( 56 void DesktopSesssionClipboardStub::InjectClipboardEvent(
57 const protocol::ClipboardEvent& event) { 57 const protocol::ClipboardEvent& event) {
58 desktop_session_agent_->InjectClipboardEvent(event); 58 desktop_session_agent_->InjectClipboardEvent(event);
59 } 59 }
60 60
61 } // namespace 61 } // namespace
62 62
63 DesktopSessionAgent::Delegate::~Delegate() {
64 }
65
63 DesktopSessionAgent::~DesktopSessionAgent() { 66 DesktopSessionAgent::~DesktopSessionAgent() {
64 DCHECK(!network_channel_); 67 DCHECK(!network_channel_);
65 DCHECK(!video_capturer_); 68 DCHECK(!video_capturer_);
66 } 69 }
67 70
68 bool DesktopSessionAgent::OnMessageReceived(const IPC::Message& message) { 71 bool DesktopSessionAgent::OnMessageReceived(const IPC::Message& message) {
69 DCHECK(caller_task_runner()->BelongsToCurrentThread()); 72 DCHECK(caller_task_runner()->BelongsToCurrentThread());
70 73
71 bool handled = true; 74 bool handled = true;
72 IPC_BEGIN_MESSAGE_MAP(DesktopSessionAgent, message) 75 IPC_BEGIN_MESSAGE_MAP(DesktopSessionAgent, message)
(...skipping 20 matching lines...) Expand all
93 VLOG(1) << "IPC: desktop <- network (" << peer_pid << ")"; 96 VLOG(1) << "IPC: desktop <- network (" << peer_pid << ")";
94 } 97 }
95 98
96 void DesktopSessionAgent::OnChannelError() { 99 void DesktopSessionAgent::OnChannelError() {
97 DCHECK(caller_task_runner()->BelongsToCurrentThread()); 100 DCHECK(caller_task_runner()->BelongsToCurrentThread());
98 101
99 // Make sure the channel is closed. 102 // Make sure the channel is closed.
100 network_channel_.reset(); 103 network_channel_.reset();
101 104
102 // Notify the caller that the channel has been disconnected. 105 // Notify the caller that the channel has been disconnected.
103 disconnected_task_.Run(); 106 delegate_->OnNetworkProcessDisconnected();
104 } 107 }
105 108
106 scoped_refptr<SharedBuffer> DesktopSessionAgent::CreateSharedBuffer( 109 scoped_refptr<SharedBuffer> DesktopSessionAgent::CreateSharedBuffer(
107 uint32 size) { 110 uint32 size) {
108 DCHECK(video_capture_task_runner()->BelongsToCurrentThread()); 111 DCHECK(video_capture_task_runner()->BelongsToCurrentThread());
109 112
110 scoped_refptr<SharedBuffer> buffer = new SharedBuffer(size); 113 scoped_refptr<SharedBuffer> buffer = new SharedBuffer(size);
111 if (buffer->ptr() != NULL) { 114 if (buffer->ptr() != NULL) {
112 buffer->set_id(next_shared_buffer_id_); 115 buffer->set_id(next_shared_buffer_id_);
113 shared_buffers_.push_back(buffer); 116 shared_buffers_.push_back(buffer);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 std::string serialized_event; 184 std::string serialized_event;
182 if (!event.SerializeToString(&serialized_event)) { 185 if (!event.SerializeToString(&serialized_event)) {
183 LOG(ERROR) << "Failed to serialize protocol::ClipboardEvent."; 186 LOG(ERROR) << "Failed to serialize protocol::ClipboardEvent.";
184 return; 187 return;
185 } 188 }
186 189
187 SendToNetwork( 190 SendToNetwork(
188 new ChromotingDesktopNetworkMsg_InjectClipboardEvent(serialized_event)); 191 new ChromotingDesktopNetworkMsg_InjectClipboardEvent(serialized_event));
189 } 192 }
190 193
191 bool DesktopSessionAgent::Start(const base::Closure& disconnected_task, 194 bool DesktopSessionAgent::Start(Delegate* delegate,
192 IPC::PlatformFileForTransit* desktop_pipe_out) { 195 IPC::PlatformFileForTransit* desktop_pipe_out) {
193 DCHECK(caller_task_runner()->BelongsToCurrentThread()); 196 DCHECK(caller_task_runner()->BelongsToCurrentThread());
197 DCHECK(delegate_ == NULL);
194 198
195 disconnected_task_ = disconnected_task; 199 delegate_ = delegate;
196 200
197 // Create an IPC channel to communicate with the network process. 201 // Create an IPC channel to communicate with the network process.
198 if (!CreateChannelForNetworkProcess(desktop_pipe_out, &network_channel_)) 202 if (!CreateChannelForNetworkProcess(desktop_pipe_out, &network_channel_))
199 return false; 203 return false;
200 204
201 // Create and start the event executor. 205 // Create and start the event executor.
202 event_executor_ = EventExecutor::Create(input_task_runner(), 206 event_executor_ = CreateEventExecutor();
203 caller_task_runner());
204 scoped_ptr<protocol::ClipboardStub> clipboard_stub( 207 scoped_ptr<protocol::ClipboardStub> clipboard_stub(
205 new DesktopSesssionClipboardStub(this)); 208 new DesktopSesssionClipboardStub(this));
206 event_executor_->Start(clipboard_stub.Pass()); 209 event_executor_->Start(clipboard_stub.Pass());
207 210
208 // Start the video capturer. 211 // Start the video capturer.
209 video_capture_task_runner()->PostTask( 212 video_capture_task_runner()->PostTask(
210 FROM_HERE, base::Bind(&DesktopSessionAgent::StartVideoCapturer, this)); 213 FROM_HERE, base::Bind(&DesktopSessionAgent::StartVideoCapturer, this));
211 return true; 214 return true;
212 } 215 }
213 216
214 void DesktopSessionAgent::Stop() { 217 void DesktopSessionAgent::Stop() {
215 DCHECK(caller_task_runner()->BelongsToCurrentThread()); 218 DCHECK(caller_task_runner()->BelongsToCurrentThread());
216 219
220 delegate_ = NULL;
221
217 // Make sure the channel is closed. 222 // Make sure the channel is closed.
218 network_channel_.reset(); 223 network_channel_.reset();
219 224
220 event_executor_.reset(); 225 event_executor_.reset();
221 226
222 // Stop the video capturer. 227 // Stop the video capturer.
223 video_capture_task_runner()->PostTask( 228 video_capture_task_runner()->PostTask(
224 FROM_HERE, base::Bind(&DesktopSessionAgent::StopVideoCapturer, this)); 229 FROM_HERE, base::Bind(&DesktopSessionAgent::StopVideoCapturer, this));
225 } 230 }
226 231
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 397
393 DesktopSessionAgent::DesktopSessionAgent( 398 DesktopSessionAgent::DesktopSessionAgent(
394 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, 399 scoped_refptr<AutoThreadTaskRunner> caller_task_runner,
395 scoped_refptr<AutoThreadTaskRunner> input_task_runner, 400 scoped_refptr<AutoThreadTaskRunner> input_task_runner,
396 scoped_refptr<AutoThreadTaskRunner> io_task_runner, 401 scoped_refptr<AutoThreadTaskRunner> io_task_runner,
397 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner) 402 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner)
398 : caller_task_runner_(caller_task_runner), 403 : caller_task_runner_(caller_task_runner),
399 input_task_runner_(input_task_runner), 404 input_task_runner_(input_task_runner),
400 io_task_runner_(io_task_runner), 405 io_task_runner_(io_task_runner),
401 video_capture_task_runner_(video_capture_task_runner), 406 video_capture_task_runner_(video_capture_task_runner),
407 delegate_(NULL),
402 next_shared_buffer_id_(1) { 408 next_shared_buffer_id_(1) {
403 DCHECK(caller_task_runner_->BelongsToCurrentThread()); 409 DCHECK(caller_task_runner_->BelongsToCurrentThread());
404 } 410 }
405 411
406 } // namespace remoting 412 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698