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

Unified Diff: remoting/webapp/base/js/application.js

Issue 895523004: [Chromoting] Add ability to enable/disable GDrive support per-app in gyp. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add Application.hasCapability Created 5 years, 11 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
« no previous file with comments | « remoting/webapp/base/js/app_capabilities.js ('k') | remoting/webapp/build-webapp.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « remoting/webapp/base/js/app_capabilities.js ('k') | remoting/webapp/build-webapp.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698