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

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: rebased 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
« no previous file with comments | « remoting/host/desktop_session_agent.h ('k') | remoting/host/desktop_session_agent_posix.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 (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 if (delegate_.get())
107 delegate_->OnNetworkProcessDisconnected();
104 } 108 }
105 109
106 scoped_refptr<SharedBuffer> DesktopSessionAgent::CreateSharedBuffer( 110 scoped_refptr<SharedBuffer> DesktopSessionAgent::CreateSharedBuffer(
107 uint32 size) { 111 uint32 size) {
108 DCHECK(video_capture_task_runner()->BelongsToCurrentThread()); 112 DCHECK(video_capture_task_runner()->BelongsToCurrentThread());
109 113
110 scoped_refptr<SharedBuffer> buffer = new SharedBuffer(size); 114 scoped_refptr<SharedBuffer> buffer = new SharedBuffer(size);
111 if (buffer->ptr() != NULL) { 115 if (buffer->ptr() != NULL) {
112 buffer->set_id(next_shared_buffer_id_); 116 buffer->set_id(next_shared_buffer_id_);
113 shared_buffers_.push_back(buffer); 117 shared_buffers_.push_back(buffer);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 std::string serialized_event; 185 std::string serialized_event;
182 if (!event.SerializeToString(&serialized_event)) { 186 if (!event.SerializeToString(&serialized_event)) {
183 LOG(ERROR) << "Failed to serialize protocol::ClipboardEvent."; 187 LOG(ERROR) << "Failed to serialize protocol::ClipboardEvent.";
184 return; 188 return;
185 } 189 }
186 190
187 SendToNetwork( 191 SendToNetwork(
188 new ChromotingDesktopNetworkMsg_InjectClipboardEvent(serialized_event)); 192 new ChromotingDesktopNetworkMsg_InjectClipboardEvent(serialized_event));
189 } 193 }
190 194
191 bool DesktopSessionAgent::Start(const base::Closure& disconnected_task, 195 bool DesktopSessionAgent::Start(const base::WeakPtr<Delegate>& delegate,
192 IPC::PlatformFileForTransit* desktop_pipe_out) { 196 IPC::PlatformFileForTransit* desktop_pipe_out) {
193 DCHECK(caller_task_runner()->BelongsToCurrentThread()); 197 DCHECK(caller_task_runner()->BelongsToCurrentThread());
198 DCHECK(delegate_.get() == NULL);
194 199
195 disconnected_task_ = disconnected_task; 200 delegate_ = delegate;
196 201
197 // Create an IPC channel to communicate with the network process. 202 // Create an IPC channel to communicate with the network process.
198 if (!CreateChannelForNetworkProcess(desktop_pipe_out, &network_channel_)) 203 if (!CreateChannelForNetworkProcess(desktop_pipe_out, &network_channel_))
199 return false; 204 return false;
200 205
201 // Create and start the event executor. 206 // Create and start the event executor.
202 event_executor_ = EventExecutor::Create(input_task_runner(), 207 event_executor_ = CreateEventExecutor();
203 caller_task_runner());
204 scoped_ptr<protocol::ClipboardStub> clipboard_stub( 208 scoped_ptr<protocol::ClipboardStub> clipboard_stub(
205 new DesktopSesssionClipboardStub(this)); 209 new DesktopSesssionClipboardStub(this));
206 event_executor_->Start(clipboard_stub.Pass()); 210 event_executor_->Start(clipboard_stub.Pass());
207 211
208 // Start the video capturer. 212 // Start the video capturer.
209 video_capture_task_runner()->PostTask( 213 video_capture_task_runner()->PostTask(
210 FROM_HERE, base::Bind(&DesktopSessionAgent::StartVideoCapturer, this)); 214 FROM_HERE, base::Bind(&DesktopSessionAgent::StartVideoCapturer, this));
211 return true; 215 return true;
212 } 216 }
213 217
214 void DesktopSessionAgent::Stop() { 218 void DesktopSessionAgent::Stop() {
215 DCHECK(caller_task_runner()->BelongsToCurrentThread()); 219 DCHECK(caller_task_runner()->BelongsToCurrentThread());
216 220
221 delegate_.reset();
222
217 // Make sure the channel is closed. 223 // Make sure the channel is closed.
218 network_channel_.reset(); 224 network_channel_.reset();
219 225
220 event_executor_.reset(); 226 event_executor_.reset();
221 227
222 // Stop the video capturer. 228 // Stop the video capturer.
223 video_capture_task_runner()->PostTask( 229 video_capture_task_runner()->PostTask(
224 FROM_HERE, base::Bind(&DesktopSessionAgent::StopVideoCapturer, this)); 230 FROM_HERE, base::Bind(&DesktopSessionAgent::StopVideoCapturer, this));
225 } 231 }
226 232
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner) 403 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner)
398 : caller_task_runner_(caller_task_runner), 404 : caller_task_runner_(caller_task_runner),
399 input_task_runner_(input_task_runner), 405 input_task_runner_(input_task_runner),
400 io_task_runner_(io_task_runner), 406 io_task_runner_(io_task_runner),
401 video_capture_task_runner_(video_capture_task_runner), 407 video_capture_task_runner_(video_capture_task_runner),
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
« no previous file with comments | « remoting/host/desktop_session_agent.h ('k') | remoting/host/desktop_session_agent_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698