diff options
author | wez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-16 18:36:52 +0000 |
---|---|---|
committer | wez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-16 18:36:52 +0000 |
commit | db97348d16cedf07f4dc520014dd6e80cb67f1d3 (patch) | |
tree | cdacbe0f0bd4aef3937efa2e462f464487671cc9 /remoting/host/host_plugin.cc | |
parent | 268b10337c65d2e6fbdf3263beeec4240e9aeb23 (diff) | |
download | chromium_src-db97348d16cedf07f4dc520014dd6e80cb67f1d3.zip chromium_src-db97348d16cedf07f4dc520014dd6e80cb67f1d3.tar.gz chromium_src-db97348d16cedf07f4dc520014dd6e80cb67f1d3.tar.bz2 |
Notify calling web-app when Host plugin becomes connected to a client.
BUG=85110
TEST=
Review URL: http://codereview.chromium.org/7134023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89370 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host/host_plugin.cc')
-rw-r--r-- | remoting/host/host_plugin.cc | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/remoting/host/host_plugin.cc b/remoting/host/host_plugin.cc index 11b621e..98f8a21 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), @@ -354,9 +354,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. @@ -457,6 +463,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. @@ -516,14 +523,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) { |