| 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 * This class implements the functionality that is specific to application | 7 * This class implements the functionality that is specific to application |
| 8 * remoting ("AppRemoting" or AR). | 8 * remoting ("AppRemoting" or AR). |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 'use strict'; | 11 'use strict'; |
| 12 | 12 |
| 13 /** @suppress {duplicate} */ | 13 /** @suppress {duplicate} */ |
| 14 var remoting = remoting || {}; | 14 var remoting = remoting || {}; |
| 15 | 15 |
| 16 /** | 16 /** |
| 17 * Parameters for the remoting.AppRemoting constructor. | 17 * @param {Array<string>} appCapabilities Array of application capabilities. |
| 18 * | 18 * @param {remoting.LicenseManager=} opt_licenseManager |
| 19 * appId: The application ID. If this is not specified than the app id will | |
| 20 * be extracted from the app's manifest. | |
| 21 * | |
| 22 * appCapabilites: Array of application capabilites. | |
| 23 * | |
| 24 * licenseManager: Licence manager for this application. | |
| 25 * | |
| 26 * @typedef {{ | |
| 27 * appId: (string|undefined), | |
| 28 * appCapabilities: (Array<string>|undefined), | |
| 29 * licenseManager: (remoting.LicenseManager|undefined) | |
| 30 * }} | |
| 31 */ | |
| 32 remoting.AppRemotingParams; | |
| 33 | |
| 34 /** | |
| 35 * @param {remoting.AppRemotingParams} args | |
| 36 * @constructor | 19 * @constructor |
| 37 * @implements {remoting.ApplicationInterface} | 20 * @implements {remoting.ApplicationInterface} |
| 38 * @extends {remoting.Application} | 21 * @extends {remoting.Application} |
| 39 */ | 22 */ |
| 40 remoting.AppRemoting = function(args) { | 23 remoting.AppRemoting = function(appCapabilities, opt_licenseManager) { |
| 41 base.inherits(this, remoting.Application); | 24 base.inherits(this, remoting.Application); |
| 42 | 25 |
| 43 /** @private {remoting.Activity} */ | 26 /** @private {remoting.Activity} */ |
| 44 this.activity_ = null; | 27 this.activity_ = null; |
| 45 | 28 |
| 46 /** @private {string} */ | |
| 47 this.appId_ = (args.appId) ? args.appId : chrome.runtime.id; | |
| 48 | |
| 49 /** @private */ | 29 /** @private */ |
| 50 this.licenseManager_ = (args.licenseManager) ? | 30 this.licenseManager_ = (opt_licenseManager) ? |
| 51 args.licenseManager : | 31 opt_licenseManager : |
| 52 new remoting.GaiaLicenseManager(); | 32 new remoting.GaiaLicenseManager(); |
| 53 | 33 |
| 54 /** @private */ | 34 /** @private */ |
| 55 this.appCapabilities_ = (args.appCapabilities) ? args.appCapabilities : []; | 35 this.appCapabilities_ = appCapabilities; |
| 56 | |
| 57 // This prefix must be added to message window paths so that the HTML | |
| 58 // files can be found in the shared module. | |
| 59 // TODO(garykac) Add support for dev/prod shared modules. | |
| 60 remoting.MessageWindow.htmlFilePrefix = | |
| 61 "_modules/koejkfhmphamcgafjmkellhnekdkopod/"; | |
| 62 }; | 36 }; |
| 63 | 37 |
| 64 /** | 38 /** |
| 65 * @return {string} Application Id. | |
| 66 * @override {remoting.ApplicationInterface} | |
| 67 */ | |
| 68 remoting.AppRemoting.prototype.getApplicationId = function() { | |
| 69 return this.appId_; | |
| 70 }; | |
| 71 | |
| 72 /** | |
| 73 * @return {string} Application product name to be used in UI. | 39 * @return {string} Application product name to be used in UI. |
| 74 * @override {remoting.ApplicationInterface} | 40 * @override {remoting.ApplicationInterface} |
| 75 */ | 41 */ |
| 76 remoting.AppRemoting.prototype.getApplicationName = function() { | 42 remoting.AppRemoting.prototype.getApplicationName = function() { |
| 77 var manifest = chrome.runtime.getManifest(); | 43 var manifest = chrome.runtime.getManifest(); |
| 78 return manifest.name; | 44 return manifest.name; |
| 79 }; | 45 }; |
| 80 | 46 |
| 81 remoting.AppRemoting.prototype.getActivity = function() { | 47 remoting.AppRemoting.prototype.getActivity = function() { |
| 82 return this.activity_; | 48 return this.activity_; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 }); | 80 }); |
| 115 }; | 81 }; |
| 116 | 82 |
| 117 /** | 83 /** |
| 118 * @override {remoting.ApplicationInterface} | 84 * @override {remoting.ApplicationInterface} |
| 119 */ | 85 */ |
| 120 remoting.AppRemoting.prototype.exitApplication_ = function() { | 86 remoting.AppRemoting.prototype.exitApplication_ = function() { |
| 121 this.activity_.dispose(); | 87 this.activity_.dispose(); |
| 122 this.closeMainWindow_(); | 88 this.closeMainWindow_(); |
| 123 }; | 89 }; |
| OLD | NEW |