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

Unified Diff: remoting/host/remoting_me2me_host.cc

Issue 11362267: Add status service for remoting host. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 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 cdf6962b31ee2a892356f655cbb26b9d5e502811..34d03ed3279d214299b971269c262e2ec25de857 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_;
@@ -493,6 +502,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)
@@ -746,6 +763,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_);
@@ -826,6 +848,9 @@ void HostProcess::StartHost() {
base::Unretained(this)));
}
+ if (status_service_)
+ status_service_->SetState(true, host_id_);
+
host_->Start(xmpp_login_);
CreateAuthenticatorFactory();
@@ -884,6 +909,9 @@ void HostProcess::Shutdown(int exit_code) {
if (shutting_down_)
return;
+ if (status_service_)
+ status_service_->SetState(false, "");
alexeypa (please no reviews) 2012/11/15 19:45:56 nit: It may be worth splitting SetState into two s
Sergey Ulanov 2012/11/16 00:52:10 Done.
+
shutting_down_ = true;
exit_code_ = exit_code;
if (host_) {
@@ -908,6 +936,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,

Powered by Google App Engine
This is Rietveld 408576698