summaryrefslogtreecommitdiffstats
path: root/remoting/host/chromoting_host.cc
diff options
context:
space:
mode:
authordcaiafa@chromium.org <dcaiafa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-29 23:25:05 +0000
committerdcaiafa@chromium.org <dcaiafa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-29 23:25:05 +0000
commit461ba001f2e77f0ffac424781579ad8632dfb3b3 (patch)
tree225b5b31f30a6734b81bd9fdd77b0825180bc6df /remoting/host/chromoting_host.cc
parent7b57481176852e0c95112f9ec697c5d2c9e75fd5 (diff)
downloadchromium_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/chromoting_host.cc')
-rw-r--r--remoting/host/chromoting_host.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc
index ef2ea19..942e643 100644
--- a/remoting/host/chromoting_host.cc
+++ b/remoting/host/chromoting_host.cc
@@ -141,6 +141,10 @@ void ChromotingHost::RemoveStatusObserver(HostStatusObserver* observer) {
status_observers_.RemoveObserver(observer);
}
+void ChromotingHost::AddExtension(scoped_ptr<HostExtension> extension) {
+ extensions_.push_back(extension.release());
+}
+
void ChromotingHost::RejectAuthenticatingClient() {
DCHECK(authenticating_client_);
reject_authenticating_client_ = true;
@@ -230,6 +234,19 @@ void ChromotingHost::OnSessionChannelsConnected(ClientSession* client) {
OnClientConnected(client->client_jid()));
}
+void ChromotingHost::OnSessionClientCapabilities(ClientSession* client) {
+ DCHECK(CalledOnValidThread());
+
+ // Create extension sessions from each registered extension for this client.
+ for (HostExtensionList::iterator extension = extensions_.begin();
+ extension != extensions_.end(); ++extension) {
+ scoped_ptr<HostExtensionSession> extension_session =
+ (*extension)->CreateExtensionSession(client);
+ if (extension_session)
+ client->AddExtensionSession(extension_session.Pass());
+ }
+}
+
void ChromotingHost::OnSessionAuthenticationFailed(ClientSession* client) {
DCHECK(CalledOnValidThread());
@@ -320,6 +337,13 @@ void ChromotingHost::OnIncomingSession(
desktop_environment_factory_,
max_session_duration_,
pairing_registry_);
+
+ // Registers capabilities provided by host extensions.
+ for (HostExtensionList::iterator extension = extensions_.begin();
+ extension != extensions_.end(); ++extension) {
+ client->AddHostCapabilities((*extension)->GetCapabilities());
+ }
+
clients_.push_back(client);
}