Index: remoting/webapp/base/js/application.js |
diff --git a/remoting/webapp/base/js/application.js b/remoting/webapp/base/js/application.js |
index 7390d8c21314ea191eddd7f40c18f2dc73cbd675..d0810be7c49049e1c4a7d37d1ba3957b55561b57 100644 |
--- a/remoting/webapp/base/js/application.js |
+++ b/remoting/webapp/base/js/application.js |
@@ -13,9 +13,10 @@ |
var remoting = remoting || {}; |
/** |
+ * @param {Array.<string>} app_capabilities Array of application capabilities. |
* @constructor |
*/ |
-remoting.Application = function() { |
+remoting.Application = function(app_capabilities) { |
/** |
* @type {remoting.Application.Delegate} |
* @private |
@@ -23,6 +24,12 @@ remoting.Application = function() { |
this.delegate_ = null; |
/** |
+ * @type {Array.<string>} |
+ * @private |
+ */ |
+ this.app_capabilities_ = app_capabilities; |
+ |
+ /** |
* @type {remoting.SessionConnector} |
* @private |
*/ |
@@ -38,6 +45,30 @@ remoting.Application.prototype.setDelegate = function(appDelegate) { |
}; |
/** |
+ * @return {Array.<string>} A list of |ClientSession.Capability|s required |
+ * by this application. |
+ */ |
+remoting.Application.prototype.getRequiredCapabilities_ = function() { |
+ var capabilities = [ |
+ remoting.ClientSession.Capability.SEND_INITIAL_RESOLUTION, |
+ remoting.ClientSession.Capability.RATE_LIMIT_RESIZE_REQUESTS, |
+ remoting.ClientSession.Capability.VIDEO_RECORDER |
+ ]; |
+ // Append the app-specific capabilities. |
+ capabilities.push.apply(capabilities, this.app_capabilities_); |
Jamie
2015/02/03 18:06:24
I think this would be better done in the ctor, to
|
+ return capabilities; |
+}; |
+ |
+/** |
+ * @param {remoting.ClientSession.Capability} capability |
+ * @return {boolean} |
+ */ |
+remoting.Application.prototype.hasCapability = function(capability) { |
+ var capabilities = remoting.app.getRequiredCapabilities_(); |
+ return capabilities.indexOf(capability) != -1; |
+}; |
+ |
+/** |
* Initialize the application and register all event handlers. After this |
* is called, the app is running and waiting for user events. |
* |
@@ -153,7 +184,7 @@ remoting.Application.prototype.getSessionConnector = function() { |
this.onError.bind(this), |
this.onExtensionMessage.bind(this), |
this.onConnectionFailed.bind(this), |
- this.delegate_.getRequiredCapabilities(), |
+ this.getRequiredCapabilities_(), |
this.delegate_.getDefaultRemapKeys()); |
} |
return this.session_connector_; |
@@ -180,12 +211,6 @@ remoting.Application.Delegate.prototype.init = function(connector) {}; |
remoting.Application.Delegate.prototype.getDefaultRemapKeys = function() {}; |
/** |
- * @return {Array.<string>} A list of |ClientSession.Capability|s required |
- * by this application. |
- */ |
-remoting.Application.Delegate.prototype.getRequiredCapabilities = function() {}; |
- |
-/** |
* Called when a new session has been connected. |
* |
* @param {remoting.ClientSession} clientSession |