| Index: remoting/host/remoting_me2me_host.cc | 
| diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc | 
| index 69b71cd23af00c1908f5582133a5efe00948a69b..883a1018e768ece4a99fedf17f77a881c11dcbd1 100644 | 
| --- a/remoting/host/remoting_me2me_host.cc | 
| +++ b/remoting/host/remoting_me2me_host.cc | 
| @@ -48,6 +48,7 @@ | 
| #include "remoting/host/host_config.h" | 
| #include "remoting/host/host_event_logger.h" | 
| #include "remoting/host/host_exit_codes.h" | 
| +#include "remoting/host/host_status_service.h" | 
| #include "remoting/host/host_user_interface.h" | 
| #include "remoting/host/ipc_consts.h" | 
| #include "remoting/host/ipc_desktop_environment_factory.h" | 
| @@ -104,6 +105,9 @@ const char kVersionSwitchName[] = "version"; | 
| // linux. | 
| const char kAudioPipeSwitchName[] = "audio-pipe-name"; | 
|  | 
| +// The command line switch used to enable host status service. | 
| +const char kEnableStatusServiceSwitchName[] = "enable-status-service"; | 
| + | 
| void QuitMessageLoop(MessageLoop* message_loop) { | 
| message_loop->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 
| } | 
| @@ -193,6 +197,8 @@ class HostProcess | 
| bool OnCurtainPolicyUpdate(bool curtain_required); | 
| bool OnHostTalkGadgetPrefixPolicyUpdate(const std::string& talkgadget_prefix); | 
|  | 
| +  void StartHostStatusService(); | 
| + | 
| void StartHost(); | 
|  | 
| void OnAuthFailed(); | 
| @@ -228,6 +234,9 @@ class HostProcess | 
| scoped_ptr<ConfigFileWatcher> config_watcher_; | 
|  | 
| // Accessed on the network thread. | 
| + | 
| +  scoped_ptr<HostStatusService> status_service_; | 
| + | 
| std::string host_id_; | 
| protocol::SharedSecretHash host_secret_hash_; | 
| HostKeyPair key_pair_; | 
| @@ -495,6 +504,14 @@ void HostProcess::StartHostProcess() { | 
| } | 
| #endif  // defined(OS_LINUX) | 
|  | 
| +  if (CommandLine::ForCurrentProcess()->HasSwitch( | 
| +          kEnableStatusServiceSwitchName)) { | 
| +    context_->network_task_runner()->PostTask( | 
| +        FROM_HERE, | 
| +        base::Bind(&HostProcess::StartHostStatusService, | 
| +                   base::Unretained(this))); | 
| +  } | 
| + | 
| // Create a desktop environment factory appropriate to the build type & | 
| // platform. | 
| #if defined(OS_WIN) | 
| @@ -765,6 +782,11 @@ bool HostProcess::OnHostTalkGadgetPrefixPolicyUpdate( | 
| return false; | 
| } | 
|  | 
| +void HostProcess::StartHostStatusService() { | 
| +  DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); | 
| +  status_service_.reset(new HostStatusService()); | 
| +} | 
| + | 
| void HostProcess::StartHost() { | 
| DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); | 
| DCHECK(!host_); | 
| @@ -846,6 +868,9 @@ void HostProcess::StartHost() { | 
| base::Unretained(this))); | 
| } | 
|  | 
| +  if (status_service_) | 
| +    status_service_->SetHostIsUp(host_id_); | 
| + | 
| host_->Start(xmpp_login_); | 
|  | 
| CreateAuthenticatorFactory(); | 
| @@ -904,6 +929,9 @@ void HostProcess::Shutdown(int exit_code) { | 
| if (shutting_down_) | 
| return; | 
|  | 
| +  if (status_service_) | 
| +    status_service_->SetHostIsDown(); | 
| + | 
| shutting_down_ = true; | 
| exit_code_ = exit_code; | 
| if (host_) { | 
| @@ -928,6 +956,8 @@ void HostProcess::OnShutdownFinished() { | 
| policy_watcher_.reset(); | 
| } | 
|  | 
| +  status_service_.reset(); | 
| + | 
| // Complete the rest of shutdown on the main thread. | 
| context_->ui_task_runner()->PostTask( | 
| FROM_HERE, | 
|  |