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

Unified Diff: remoting/host/client_session.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/client_session.cc
diff --git a/remoting/host/client_session.cc b/remoting/host/client_session.cc
index fd1e441d7d673966286828f562c52936cb76909c..b2624a83ce6073e0428f00db9ba28914048823b5 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(" ");
Wez 2014/05/28 23:03:41 See comment in ChromotingHost re doing this accumu
dcaiafa 2014/05/29 00:03:16 As you mentioned in the comment's message, AddHost
+
+ 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_->OnClientCapabilities(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_->OnClientCapabilities(this);
+
desktop_environment_->SetCapabilities(*client_capabilities_);
}

Powered by Google App Engine
This is Rietveld 408576698