Chromium Code Reviews| 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..fd88108c745a2815043530fd75495cc1f87f9795 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_features Array of application features. |
|
Jamie
2015/02/02 22:57:47
There's confusion in this file as to "features" vs
garykac
2015/02/03 01:50:21
Done.
|
| * @constructor |
| */ |
| -remoting.Application = function() { |
| +remoting.Application = function(app_features) { |
| /** |
| * @type {remoting.Application.Delegate} |
| * @private |
| @@ -23,6 +24,12 @@ remoting.Application = function() { |
| this.delegate_ = null; |
| /** |
| + * @type {Array.<string>} |
| + * @private |
| + */ |
| + this.app_features_ = app_features; |
| + |
| + /** |
| * @type {remoting.SessionConnector} |
| * @private |
| */ |
| @@ -38,6 +45,25 @@ 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 |
| + ]; |
| + if (this.app_features_.indexOf('cast') != -1) { |
| + capabilities.push(remoting.ClientSession.Capability.CAST); |
| + } |
| + if (this.app_features_.indexOf('gdrive') != -1) { |
| + capabilities.push(remoting.ClientSession.Capability.GOOGLE_DRIVE); |
| + } |
| + return capabilities; |
| +}; |
| + |
| +/** |
| * Initialize the application and register all event handlers. After this |
| * is called, the app is running and waiting for user events. |
| * |
| @@ -153,7 +179,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 +206,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 |