Index: remoting/host/host_plugin.cc |
diff --git a/remoting/host/host_plugin.cc b/remoting/host/host_plugin.cc |
index 3189634df27dffd42252858a5654a832f280d42d..954fe63bd2415ade778744671eb2fd1919603786 100644 |
--- a/remoting/host/host_plugin.cc |
+++ b/remoting/host/host_plugin.cc |
@@ -131,7 +131,7 @@ NPObject* ObjectFromNPVariant(const NPVariant& variant) { |
} |
// NPAPI plugin implementation for remoting host script object. |
-class HostNPScriptObject { |
+class HostNPScriptObject : remoting::HostStatusObserver { |
public: |
HostNPScriptObject(NPP plugin, NPObject* parent) |
: plugin_(plugin), |
@@ -352,9 +352,15 @@ class HostNPScriptObject { |
void OnReceivedSupportID(remoting::SupportAccessVerifier* access_verifier, |
bool success, |
const std::string& support_id); |
- void OnConnected(); |
void OnHostShutdown(); |
+ // HostStatusObserver interface. |
+ virtual void OnSignallingConnected(remoting::SignalStrategy* signal_strategy, |
+ const std::string& full_jid) {} |
+ virtual void OnSignallingDisconnected() {} |
+ virtual void OnAuthenticatedClientsChanged(int clients_connected); |
+ virtual void OnShutdown() {} |
+ |
// Call a JavaScript function wrapped as an NPObject. |
// If result is non-null, the result of the call will be stored in it. |
// Caller is responsible for releasing result if they ask for it. |
@@ -454,6 +460,7 @@ bool HostNPScriptObject::Connect(const NPVariant* args, |
remoting::ChromotingHost::Create(&host_context_, host_config, |
access_verifier.release()); |
host->AddStatusObserver(register_request); |
+ host->AddStatusObserver(this); |
host->set_me2mom(true); |
// Nothing went wrong, so lets save the host, config and request. |
@@ -513,14 +520,14 @@ void HostNPScriptObject::OnReceivedSupportID( |
OnStateChanged(kReceivedAccessCode); |
} |
-void HostNPScriptObject::OnConnected() { |
+void HostNPScriptObject::OnHostShutdown() { |
CHECK_NE(base::PlatformThread::CurrentId(), np_thread_id_); |
- OnStateChanged(kConnected); |
+ OnStateChanged(kDisconnected); |
} |
-void HostNPScriptObject::OnHostShutdown() { |
+void HostNPScriptObject::OnAuthenticatedClientsChanged(int clients_connected) { |
CHECK_NE(base::PlatformThread::CurrentId(), np_thread_id_); |
- OnStateChanged(kDisconnected); |
+ OnStateChanged(clients_connected ? kConnected : kDisconnected); |
} |
void HostNPScriptObject::OnStateChanged(State state) { |