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

Unified Diff: remoting/host/remoting_me2me_host.cc

Issue 10837291: [Chromoting] Moving the daemon IPC channel to ChromotingHostContext. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months 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 side-by-side diff with in-line comments
Download patch
Index: remoting/host/remoting_me2me_host.cc
diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc
index 701ce32be5e7347918ff560a4824acf9ee4dacfc..046df9d28c7ec034c8c993ec46cccb75a2a0bbfb 100644
--- a/remoting/host/remoting_me2me_host.cc
+++ b/remoting/host/remoting_me2me_host.cc
@@ -24,6 +24,7 @@
#include "base/win/windows_version.h"
#include "build/build_config.h"
#include "crypto/nss_util.h"
+#include "ipc/ipc_channel.h"
#include "net/base/network_change_notifier.h"
#include "net/socket/ssl_server_socket.h"
#include "remoting/base/breakpad.h"
@@ -68,6 +69,9 @@ namespace {
// This is used for tagging system event logs.
const char kApplicationName[] = "chromoting";
+// The command line switch specifying the name of the Chromoting IPC channel.
+const char kDaemonIpcSwitchName[] = "chromoting-ipc";
+
// These are used for parsing the config-file locations from the command line,
// and for defining the default locations if the switches are not present.
const char kAuthConfigSwitchName[] = "auth-config";
@@ -92,7 +96,8 @@ const char kOfficialOAuth2ClientSecret[] = "Bgur6DFiOMM1h8x-AQpuTQlK";
namespace remoting {
class HostProcess
- : public HeartbeatSender::Listener {
+ : public HeartbeatSender::Listener,
+ public IPC::Listener {
public:
HostProcess()
: message_loop_(MessageLoop::TYPE_UI),
@@ -122,6 +127,18 @@ class HostProcess
}
bool InitWithCommandLine(const CommandLine* cmd_line) {
+ // Connect to the daemon process.
+ std::string channel_name =
+ cmd_line->GetSwitchValueASCII(kDaemonIpcSwitchName);
+
+#if defined(REMOTING_MULTI_PROCESS)
+ if (channel_name.empty())
+ return false;
+#endif // defined(REMOTING_MULTI_PROCESS)
+
+ if (!channel_name.empty())
+ context_->ConnectToDaemon(channel_name, this);
+
FilePath default_config_dir = remoting::GetConfigDir();
if (cmd_line->HasSwitch(kAuthConfigSwitchName)) {
FilePath path = cmd_line->GetSwitchValuePath(kAuthConfigSwitchName);
@@ -212,6 +229,11 @@ class HostProcess
host_->SetAuthenticatorFactory(factory.Pass());
}
+ // IPC::Listener implementation.
+ virtual bool OnMessageReceived(const IPC::Message& message) {
+ return false;
+ }
+
int Run() {
if (!LoadConfig()) {
return kInvalidHostConfigurationExitCode;
@@ -235,6 +257,7 @@ class HostProcess
host_user_interface_.reset();
#endif
+ context_->DisconnectFromDaemon();
base::WaitableEvent done_event(true, false);
policy_watcher_->StopWatching(&done_event);
done_event.Wait();

Powered by Google App Engine
This is Rietveld 408576698