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

Unified Diff: remoting/host/chromoting_host.cc

Issue 301453003: Host extensions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ChromotingHost creates extension sessions, and adds capabilities Created 6 years, 7 months 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/chromoting_host.cc
diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc
index ef2ea19729cbfa0db13c4103320406a72189d06e..279b6480c6bdbb397e3dd0616ddf1c2606b24ab4 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;
@@ -209,6 +213,12 @@ bool ChromotingHost::OnSessionAuthenticated(ClientSession* client) {
// Disconnects above must have destroyed all other clients.
DCHECK_EQ(clients_.size(), 1U);
+ // Registers capabilities provided by host extensions.
+ for (HostExtensionList::iterator extension = extensions_.begin();
+ extension != extensions_.end(); ++extension) {
+ client->AddHostCapabilities((*extension)->GetCapabilities());
Wez 2014/05/28 23:03:41 Do you really need to do this here? Could it wait
Wez 2014/05/28 23:03:41 If not then it would seem cleaner to have SetHostC
dcaiafa 2014/05/29 00:03:16 We need to send the host capabilities to the clien
dcaiafa 2014/05/29 00:03:16 As you mentioned in the comment's message, AddHost
+ }
+
// Notify observers that there is at least one authenticated client.
const std::string& jid = client->client_jid();
@@ -230,6 +240,19 @@ void ChromotingHost::OnSessionChannelsConnected(ClientSession* client) {
OnClientConnected(client->client_jid()));
}
+void ChromotingHost::OnClientCapabilities(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());

Powered by Google App Engine
This is Rietveld 408576698