diff options
author | dcaiafa@chromium.org <dcaiafa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-29 23:25:05 +0000 |
---|---|---|
committer | dcaiafa@chromium.org <dcaiafa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-29 23:25:05 +0000 |
commit | 461ba001f2e77f0ffac424781579ad8632dfb3b3 (patch) | |
tree | 225b5b31f30a6734b81bd9fdd77b0825180bc6df /remoting/host/client_session.cc | |
parent | 7b57481176852e0c95112f9ec697c5d2c9e75fd5 (diff) | |
download | chromium_src-461ba001f2e77f0ffac424781579ad8632dfb3b3.zip chromium_src-461ba001f2e77f0ffac424781579ad8632dfb3b3.tar.gz chromium_src-461ba001f2e77f0ffac424781579ad8632dfb3b3.tar.bz2 |
Host extensions
This CL introduces HostExtension, an interface for classes that
extend the host with non-core functionality.
Extensions are added to the ChromotingHost. They are used to compile
the list of capabilities reported to the client, which can be used by
the client to determine the availability of the extension.
When a client connects, a HostExtension has the opportunity to create
an HostExtensionSession to hold client/extension state, and to handle
extension messages from that client.
BUG=
Review URL: https://codereview.chromium.org/301453003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@273652 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host/client_session.cc')
-rw-r--r-- | remoting/host/client_session.cc | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/remoting/host/client_session.cc b/remoting/host/client_session.cc index fd1e441..0361932 100644 --- a/remoting/host/client_session.cc +++ b/remoting/host/client_session.cc @@ -18,6 +18,7 @@ #include "remoting/host/audio_capturer.h" #include "remoting/host/audio_scheduler.h" #include "remoting/host/desktop_environment.h" +#include "remoting/host/host_extension_session.h" #include "remoting/host/input_injector.h" #include "remoting/host/screen_controls.h" #include "remoting/host/screen_resolution.h" @@ -98,6 +99,25 @@ ClientSession::~ClientSession() { connection_.reset(); } +void ClientSession::AddExtensionSession( + scoped_ptr<HostExtensionSession> extension_session) { + DCHECK(CalledOnValidThread()); + + extension_sessions_.push_back(extension_session.release()); +} + +void ClientSession::AddHostCapabilities(const std::string& capabilities) { + DCHECK(CalledOnValidThread()); + + if (capabilities.empty()) + return; + + if (!host_capabilities_.empty()) + host_capabilities_.append(" "); + + host_capabilities_.append(capabilities); +} + void ClientSession::NotifyClientResolution( const protocol::ClientResolution& resolution) { DCHECK(CalledOnValidThread()); @@ -168,6 +188,7 @@ void ClientSession::SetCapabilities( *client_capabilities_ = capabilities.capabilities(); VLOG(1) << "Client capabilities: " << *client_capabilities_; + event_handler_->OnSessionClientCapabilities(this); // Calculate the set of capabilities enabled by both client and host and // pass it to the desktop environment if it is available. @@ -204,6 +225,13 @@ void ClientSession::DeliverClientMessage( HOST_LOG << "gnubby auth is not enabled"; } return; + } else { + for(HostExtensionSessionList::iterator it = extension_sessions_.begin(); + it != extension_sessions_.end(); ++it) { + // Extension returns |true| to indicate that the message was handled. + if ((*it)->OnExtensionMessage(this, message)) + return; + } } } HOST_LOG << "Unexpected message received: " @@ -253,7 +281,7 @@ void ClientSession::OnConnectionAuthenticated( return; } - host_capabilities_ = desktop_environment_->GetCapabilities(); + AddHostCapabilities(desktop_environment_->GetCapabilities()); // Ignore protocol::Capabilities messages from the client if it does not // support any capabilities. @@ -261,6 +289,8 @@ void ClientSession::OnConnectionAuthenticated( VLOG(1) << "The client does not support any capabilities."; client_capabilities_ = make_scoped_ptr(new std::string()); + event_handler_->OnSessionClientCapabilities(this); + desktop_environment_->SetCapabilities(*client_capabilities_); } |