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

Side by Side Diff: remoting/webapp/app_remoting/js/app_remoting.js

Issue 1179873005: [AppRemoting] Break out AppRemoting shared module (re-land). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 unified diff | Download patch
OLDNEW
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 * @param {Array<string>} appCapabilities Array of application capabilities. 17 * Parameters for the remoting.AppRemoting constructor.
18 * @param {remoting.LicenseManager=} opt_licenseManager 18 *
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
19 * @constructor 36 * @constructor
20 * @implements {remoting.ApplicationInterface} 37 * @implements {remoting.ApplicationInterface}
21 * @extends {remoting.Application} 38 * @extends {remoting.Application}
22 */ 39 */
23 remoting.AppRemoting = function(appCapabilities, opt_licenseManager) { 40 remoting.AppRemoting = function(args) {
24 base.inherits(this, remoting.Application); 41 base.inherits(this, remoting.Application);
25 42
26 /** @private {remoting.Activity} */ 43 /** @private {remoting.Activity} */
27 this.activity_ = null; 44 this.activity_ = null;
28 45
46 /** @private {string} */
47 this.appId_ = (args.appId) ? args.appId : chrome.runtime.id;
48
29 /** @private */ 49 /** @private */
30 this.licenseManager_ = (opt_licenseManager) ? 50 this.licenseManager_ = (args.licenseManager) ?
31 opt_licenseManager : 51 args.licenseManager :
32 new remoting.GaiaLicenseManager(); 52 new remoting.GaiaLicenseManager();
33 53
34 /** @private */ 54 /** @private */
35 this.appCapabilities_ = appCapabilities; 55 this.appCapabilities_ = (args.appCapabilities) ? args.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/";
36 }; 62 };
37 63
38 /** 64 /**
65 * @return {string} Application Id.
66 * @override {remoting.ApplicationInterface}
67 */
68 remoting.AppRemoting.prototype.getApplicationId = function() {
69 return this.appId_;
70 };
71
72 /**
39 * @return {string} Application product name to be used in UI. 73 * @return {string} Application product name to be used in UI.
40 * @override {remoting.ApplicationInterface} 74 * @override {remoting.ApplicationInterface}
41 */ 75 */
42 remoting.AppRemoting.prototype.getApplicationName = function() { 76 remoting.AppRemoting.prototype.getApplicationName = function() {
43 var manifest = chrome.runtime.getManifest(); 77 var manifest = chrome.runtime.getManifest();
44 return manifest.name; 78 return manifest.name;
45 }; 79 };
46 80
47 remoting.AppRemoting.prototype.getActivity = function() { 81 remoting.AppRemoting.prototype.getActivity = function() {
48 return this.activity_; 82 return this.activity_;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 }); 114 });
81 }; 115 };
82 116
83 /** 117 /**
84 * @override {remoting.ApplicationInterface} 118 * @override {remoting.ApplicationInterface}
85 */ 119 */
86 remoting.AppRemoting.prototype.exitApplication_ = function() { 120 remoting.AppRemoting.prototype.exitApplication_ = function() {
87 this.activity_.dispose(); 121 this.activity_.dispose();
88 this.closeMainWindow_(); 122 this.closeMainWindow_();
89 }; 123 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698