| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @fileoverview | 6 * @fileoverview |
| 7 * Interface abstracting the Application functionality. | 7 * Interface abstracting the Application functionality. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 'use strict'; | 10 'use strict'; |
| 11 | 11 |
| 12 /** @suppress {duplicate} */ | 12 /** @suppress {duplicate} */ |
| 13 var remoting = remoting || {}; | 13 var remoting = remoting || {}; |
| 14 | 14 |
| 15 /** | 15 /** |
| 16 * @param {Array.<string>} app_capabilities Array of application capabilities. | 16 * @param {Array.<string>} app_capabilities Array of application capabilities. |
| 17 * @constructor | 17 * @constructor |
| 18 */ | 18 */ |
| 19 remoting.Application = function(app_capabilities) { | 19 remoting.Application = function(app_capabilities) { |
| 20 /** | 20 /** |
| 21 * @type {remoting.Application.Delegate} | 21 * @type {remoting.Application.Delegate} |
| 22 * @private | 22 * @private |
| 23 */ | 23 */ |
| 24 this.delegate_ = null; | 24 this.delegate_ = null; |
| 25 | 25 |
| 26 /** | 26 /** |
| 27 * @type {Array.<string>} | 27 * @type {Array.<string>} |
| 28 * @private | 28 * @private |
| 29 */ | 29 */ |
| 30 this.app_capabilities_ = app_capabilities; | 30 this.app_capabilities_ = [ |
| 31 remoting.ClientSession.Capability.SEND_INITIAL_RESOLUTION, |
| 32 remoting.ClientSession.Capability.RATE_LIMIT_RESIZE_REQUESTS, |
| 33 remoting.ClientSession.Capability.VIDEO_RECORDER |
| 34 ]; |
| 35 // Append the app-specific capabilities. |
| 36 this.app_capabilities_.push.apply(this.app_capabilities_, app_capabilities); |
| 31 | 37 |
| 32 /** | 38 /** |
| 33 * @type {remoting.SessionConnector} | 39 * @type {remoting.SessionConnector} |
| 34 * @private | 40 * @private |
| 35 */ | 41 */ |
| 36 this.session_connector_ = null; | 42 this.session_connector_ = null; |
| 37 }; | 43 }; |
| 38 | 44 |
| 39 /** | 45 /** |
| 40 * @param {remoting.Application.Delegate} appDelegate The delegate that | 46 * @param {remoting.Application.Delegate} appDelegate The delegate that |
| 41 * contains the app-specific functionality. | 47 * contains the app-specific functionality. |
| 42 */ | 48 */ |
| 43 remoting.Application.prototype.setDelegate = function(appDelegate) { | 49 remoting.Application.prototype.setDelegate = function(appDelegate) { |
| 44 this.delegate_ = appDelegate; | 50 this.delegate_ = appDelegate; |
| 45 }; | 51 }; |
| 46 | 52 |
| 47 /** | 53 /** |
| 48 * @return {Array.<string>} A list of |ClientSession.Capability|s required | 54 * @return {Array.<string>} A list of |ClientSession.Capability|s required |
| 49 * by this application. | 55 * by this application. |
| 50 */ | 56 */ |
| 51 remoting.Application.prototype.getRequiredCapabilities_ = function() { | 57 remoting.Application.prototype.getRequiredCapabilities_ = function() { |
| 52 var capabilities = [ | 58 return this.app_capabilities_; |
| 53 remoting.ClientSession.Capability.SEND_INITIAL_RESOLUTION, | |
| 54 remoting.ClientSession.Capability.RATE_LIMIT_RESIZE_REQUESTS, | |
| 55 remoting.ClientSession.Capability.VIDEO_RECORDER | |
| 56 ]; | |
| 57 // Append the app-specific capabilities. | |
| 58 capabilities.push.apply(capabilities, this.app_capabilities_); | |
| 59 return capabilities; | |
| 60 }; | 59 }; |
| 61 | 60 |
| 62 /** | 61 /** |
| 63 * @param {remoting.ClientSession.Capability} capability | 62 * @param {remoting.ClientSession.Capability} capability |
| 64 * @return {boolean} | 63 * @return {boolean} |
| 65 */ | 64 */ |
| 66 remoting.Application.prototype.hasCapability = function(capability) { | 65 remoting.Application.prototype.hasCapability = function(capability) { |
| 67 var capabilities = remoting.app.getRequiredCapabilities_(); | 66 var capabilities = remoting.app.getRequiredCapabilities_(); |
| 68 return capabilities.indexOf(capability) != -1; | 67 return capabilities.indexOf(capability) != -1; |
| 69 }; | 68 }; |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 * Called when an error needs to be displayed to the user. | 258 * Called when an error needs to be displayed to the user. |
| 260 * | 259 * |
| 261 * @param {remoting.Error} errorTag The error to be localized and displayed. | 260 * @param {remoting.Error} errorTag The error to be localized and displayed. |
| 262 * @return {void} Nothing. | 261 * @return {void} Nothing. |
| 263 */ | 262 */ |
| 264 remoting.Application.Delegate.prototype.handleError = function(errorTag) {}; | 263 remoting.Application.Delegate.prototype.handleError = function(errorTag) {}; |
| 265 | 264 |
| 266 | 265 |
| 267 /** @type {remoting.Application} */ | 266 /** @type {remoting.Application} */ |
| 268 remoting.app = null; | 267 remoting.app = null; |
| OLD | NEW |