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

Side by Side Diff: remoting/host/win/wts_session_process_delegate.cc

Issue 2451953002: Use ChannelMojo between the remoting network and desktop processes. (Closed)
Patch Set: Created 4 years, 1 month 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/win/unprivileged_process_delegate.cc ('k') | no next file » | 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 // This file implements the Windows service controlling Me2Me host processes 5 // This file implements the Windows service controlling Me2Me host processes
6 // running within user sessions. 6 // running within user sessions.
7 7
8 #include "remoting/host/win/wts_session_process_delegate.h" 8 #include "remoting/host/win/wts_session_process_delegate.h"
9 9
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/message_loop/message_loop.h" 17 #include "base/message_loop/message_loop.h"
18 #include "base/process/process_handle.h" 18 #include "base/process/process_handle.h"
19 #include "base/single_thread_task_runner.h" 19 #include "base/single_thread_task_runner.h"
20 #include "base/strings/utf_string_conversions.h" 20 #include "base/strings/utf_string_conversions.h"
21 #include "base/threading/thread_task_runner_handle.h" 21 #include "base/threading/thread_task_runner_handle.h"
22 #include "base/win/scoped_handle.h" 22 #include "base/win/scoped_handle.h"
23 #include "ipc/attachment_broker.h"
24 #include "ipc/ipc_channel.h" 23 #include "ipc/ipc_channel.h"
25 #include "ipc/ipc_channel_proxy.h" 24 #include "ipc/ipc_channel_proxy.h"
26 #include "ipc/ipc_listener.h" 25 #include "ipc/ipc_listener.h"
27 #include "ipc/ipc_message.h" 26 #include "ipc/ipc_message.h"
28 #include "mojo/edk/embedder/embedder.h" 27 #include "mojo/edk/embedder/embedder.h"
29 #include "mojo/edk/embedder/named_platform_channel_pair.h" 28 #include "mojo/edk/embedder/named_platform_channel_pair.h"
30 #include "mojo/edk/embedder/platform_channel_pair.h" 29 #include "mojo/edk/embedder/platform_channel_pair.h"
31 #include "mojo/edk/embedder/platform_handle_utils.h" 30 #include "mojo/edk/embedder/platform_handle_utils.h"
32 #include "mojo/edk/embedder/scoped_platform_handle.h" 31 #include "mojo/edk/embedder/scoped_platform_handle.h"
33 #include "remoting/host/host_main.h" 32 #include "remoting/host/host_main.h"
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 delete message; 248 delete message;
250 } 249 }
251 } 250 }
252 251
253 void WtsSessionProcessDelegate::Core::CloseChannel() { 252 void WtsSessionProcessDelegate::Core::CloseChannel() {
254 DCHECK(caller_task_runner_->BelongsToCurrentThread()); 253 DCHECK(caller_task_runner_->BelongsToCurrentThread());
255 254
256 if (!channel_) 255 if (!channel_)
257 return; 256 return;
258 257
259 IPC::AttachmentBroker::GetGlobal()->DeregisterCommunicationChannel(
260 channel_.get());
261 channel_.reset(); 258 channel_.reset();
262 elevated_server_handle_.reset(); 259 elevated_server_handle_.reset();
263 elevated_launcher_pid_ = base::kNullProcessId; 260 elevated_launcher_pid_ = base::kNullProcessId;
264 if (!mojo_child_token_.empty()) { 261 if (!mojo_child_token_.empty()) {
265 mojo::edk::ChildProcessLaunchFailed(mojo_child_token_); 262 mojo::edk::ChildProcessLaunchFailed(mojo_child_token_);
266 mojo_child_token_.clear(); 263 mojo_child_token_.clear();
267 } 264 }
268 } 265 }
269 266
270 void WtsSessionProcessDelegate::Core::KillProcess() { 267 void WtsSessionProcessDelegate::Core::KillProcess() {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 355
359 // Create the command line passing the name of the IPC channel to use and 356 // Create the command line passing the name of the IPC channel to use and
360 // copying known switches from the caller's command line. 357 // copying known switches from the caller's command line.
361 command_line.SetProgram(helper_binary); 358 command_line.SetProgram(helper_binary);
362 command_line.AppendSwitchPath(kElevateSwitchName, 359 command_line.AppendSwitchPath(kElevateSwitchName,
363 target_command_->GetProgram()); 360 target_command_->GetProgram());
364 } 361 }
365 362
366 const std::string mojo_message_pipe_token = mojo::edk::GenerateRandomToken(); 363 const std::string mojo_message_pipe_token = mojo::edk::GenerateRandomToken();
367 mojo_child_token_ = mojo::edk::GenerateRandomToken(); 364 mojo_child_token_ = mojo::edk::GenerateRandomToken();
368 std::unique_ptr<IPC::ChannelProxy> channel( 365 std::unique_ptr<IPC::ChannelProxy> channel = IPC::ChannelProxy::Create(
369 new IPC::ChannelProxy(this, io_task_runner_)); 366 mojo::edk::CreateParentMessagePipe(mojo_message_pipe_token,
370 IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel( 367 mojo_child_token_)
371 channel.get(), io_task_runner_); 368 .release(),
372 channel->Init(mojo::edk::CreateParentMessagePipe(mojo_message_pipe_token, 369 IPC::Channel::MODE_SERVER, this, io_task_runner_);
373 mojo_child_token_)
374 .release(),
375 IPC::Channel::MODE_SERVER, /*create_pipe_now=*/true);
376 command_line.AppendSwitchASCII(kMojoPipeToken, mojo_message_pipe_token); 370 command_line.AppendSwitchASCII(kMojoPipeToken, mojo_message_pipe_token);
377 371
378 std::unique_ptr<mojo::edk::PlatformChannelPair> normal_mojo_channel; 372 std::unique_ptr<mojo::edk::PlatformChannelPair> normal_mojo_channel;
379 std::unique_ptr<mojo::edk::NamedPlatformChannelPair> elevated_mojo_channel; 373 std::unique_ptr<mojo::edk::NamedPlatformChannelPair> elevated_mojo_channel;
380 base::HandlesToInheritVector handles_to_inherit; 374 base::HandlesToInheritVector handles_to_inherit;
381 if (launch_elevated_) { 375 if (launch_elevated_) {
382 // Pass the name of the IPC channel to use. 376 // Pass the name of the IPC channel to use.
383 mojo::edk::NamedPlatformChannelPair::Options options; 377 mojo::edk::NamedPlatformChannelPair::Options options;
384 options.security_descriptor = base::UTF8ToUTF16(channel_security_); 378 options.security_descriptor = base::UTF8ToUTF16(channel_security_);
385 elevated_mojo_channel = 379 elevated_mojo_channel =
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 594
601 void WtsSessionProcessDelegate::CloseChannel() { 595 void WtsSessionProcessDelegate::CloseChannel() {
602 core_->CloseChannel(); 596 core_->CloseChannel();
603 } 597 }
604 598
605 void WtsSessionProcessDelegate::KillProcess() { 599 void WtsSessionProcessDelegate::KillProcess() {
606 core_->KillProcess(); 600 core_->KillProcess();
607 } 601 }
608 602
609 } // namespace remoting 603 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/win/unprivileged_process_delegate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698