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 // This file implements a standalone host process for Me2Me. | 5 // This file implements a standalone host process for Me2Me. |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 | 451 |
452 scoped_ptr<ChromotingHost> host_; | 452 scoped_ptr<ChromotingHost> host_; |
453 | 453 |
454 // Used to keep this HostProcess alive until it is shutdown. | 454 // Used to keep this HostProcess alive until it is shutdown. |
455 scoped_refptr<HostProcess> self_; | 455 scoped_refptr<HostProcess> self_; |
456 | 456 |
457 #if defined(REMOTING_MULTI_PROCESS) | 457 #if defined(REMOTING_MULTI_PROCESS) |
458 // Accessed on the UI thread. | 458 // Accessed on the UI thread. |
459 scoped_ptr<IPC::ChannelProxy> daemon_channel_; | 459 scoped_ptr<IPC::ChannelProxy> daemon_channel_; |
460 | 460 |
| 461 // AttachmentBroker for |daemon_channel_|. |
| 462 scoped_ptr<IPC::AttachmentBrokerUnprivileged> attachment_broker_; |
| 463 |
461 // Owned as |desktop_environment_factory_|. | 464 // Owned as |desktop_environment_factory_|. |
462 DesktopSessionConnector* desktop_session_connector_ = nullptr; | 465 DesktopSessionConnector* desktop_session_connector_ = nullptr; |
463 #endif // defined(REMOTING_MULTI_PROCESS) | 466 #endif // defined(REMOTING_MULTI_PROCESS) |
464 | 467 |
465 int* exit_code_out_; | 468 int* exit_code_out_; |
466 bool signal_parent_; | 469 bool signal_parent_; |
467 | 470 |
468 scoped_refptr<PairingRegistry> pairing_registry_; | 471 scoped_refptr<PairingRegistry> pairing_registry_; |
469 | 472 |
470 ShutdownWatchdog* shutdown_watchdog_; | 473 ShutdownWatchdog* shutdown_watchdog_; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 base::FileDescriptor pipe(pipe_handle, true); | 535 base::FileDescriptor pipe(pipe_handle, true); |
533 IPC::ChannelHandle channel_handle(channel_name, pipe); | 536 IPC::ChannelHandle channel_handle(channel_name, pipe); |
534 #endif // defined(OS_POSIX) | 537 #endif // defined(OS_POSIX) |
535 | 538 |
536 // Connect to the daemon process. | 539 // Connect to the daemon process. |
537 daemon_channel_ = IPC::ChannelProxy::Create(channel_handle, | 540 daemon_channel_ = IPC::ChannelProxy::Create(channel_handle, |
538 IPC::Channel::MODE_CLIENT, | 541 IPC::Channel::MODE_CLIENT, |
539 this, | 542 this, |
540 context_->network_task_runner()); | 543 context_->network_task_runner()); |
541 | 544 |
542 IPC::AttachmentBrokerUnprivileged::CreateBrokerIfNeeded(); | 545 attachment_broker_ = IPC::AttachmentBrokerUnprivileged::CreateBroker(); |
543 IPC::AttachmentBroker* broker = IPC::AttachmentBroker::GetGlobal(); | 546 if (attachment_broker_) { |
544 if (broker && !broker->IsPrivilegedBroker()) | 547 attachment_broker_->DesignateBrokerCommunicationChannel( |
545 broker->DesignateBrokerCommunicationChannel(daemon_channel_.get()); | 548 daemon_channel_.get()); |
| 549 } |
546 | 550 |
547 #else // !defined(REMOTING_MULTI_PROCESS) | 551 #else // !defined(REMOTING_MULTI_PROCESS) |
548 if (cmd_line->HasSwitch(kHostConfigSwitchName)) { | 552 if (cmd_line->HasSwitch(kHostConfigSwitchName)) { |
549 host_config_path_ = cmd_line->GetSwitchValuePath(kHostConfigSwitchName); | 553 host_config_path_ = cmd_line->GetSwitchValuePath(kHostConfigSwitchName); |
550 | 554 |
551 // Read config from stdin if necessary. | 555 // Read config from stdin if necessary. |
552 if (host_config_path_ == base::FilePath(kStdinConfigPath)) { | 556 if (host_config_path_ == base::FilePath(kStdinConfigPath)) { |
553 const size_t kBufferSize = 4096; | 557 const size_t kBufferSize = 4096; |
554 scoped_ptr<char[]> buf(new char[kBufferSize]); | 558 scoped_ptr<char[]> buf(new char[kBufferSize]); |
555 size_t len; | 559 size_t len; |
(...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1735 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); | 1739 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); |
1736 new HostProcess(std::move(context), &exit_code, &shutdown_watchdog); | 1740 new HostProcess(std::move(context), &exit_code, &shutdown_watchdog); |
1737 | 1741 |
1738 // Run the main (also UI) message loop until the host no longer needs it. | 1742 // Run the main (also UI) message loop until the host no longer needs it. |
1739 message_loop.Run(); | 1743 message_loop.Run(); |
1740 | 1744 |
1741 return exit_code; | 1745 return exit_code; |
1742 } | 1746 } |
1743 | 1747 |
1744 } // namespace remoting | 1748 } // namespace remoting |
OLD | NEW |