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

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

Issue 1816653002: Remove app_remoting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
(Empty)
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
3 // found in the LICENSE file.
4
5 /**
6 * @fileoverview
7 * This class implements the functionality that is specific to application
8 * remoting ("AppRemoting" or AR).
9 */
10
11 'use strict';
12
13 /** @suppress {duplicate} */
14 var remoting = remoting || {};
15
16 /**
17 * Parameters for the remoting.AppRemoting constructor.
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
36 * @constructor
37 * @implements {remoting.ApplicationInterface}
38 * @extends {remoting.Application}
39 */
40 remoting.AppRemoting = function(args) {
41 base.inherits(this, remoting.Application);
42 remoting.app = this;
43
44 // Save recent errors for inclusion in user feedback.
45 remoting.ConsoleWrapper.getInstance().activate(
46 5,
47 remoting.ConsoleWrapper.LogType.ERROR,
48 remoting.ConsoleWrapper.LogType.ASSERT);
49
50 /** @private {remoting.Activity} */
51 this.activity_ = null;
52
53 /** @private {string} */
54 this.appId_ = (args.appId) ? args.appId : chrome.runtime.id;
55
56 /** @private */
57 this.licenseManager_ = (args.licenseManager) ?
58 args.licenseManager :
59 new remoting.GaiaLicenseManager();
60
61 /** @private */
62 this.appCapabilities_ = (args.appCapabilities) ? args.appCapabilities : [];
63
64 // This prefix must be added to message window paths so that the HTML
65 // files can be found in the shared module.
66 // TODO(garykac) Add support for dev/prod shared modules.
67 remoting.MessageWindow.htmlFilePrefix =
68 "_modules/koejkfhmphamcgafjmkellhnekdkopod/";
69 };
70
71 /**
72 * @return {string} Application Id.
73 * @override {remoting.ApplicationInterface}
74 */
75 remoting.AppRemoting.prototype.getApplicationId = function() {
76 return this.appId_;
77 };
78
79 /**
80 * @return {string} Application product name to be used in UI.
81 * @override {remoting.ApplicationInterface}
82 */
83 remoting.AppRemoting.prototype.getApplicationName = function() {
84 var manifest = chrome.runtime.getManifest();
85 return manifest.name;
86 };
87
88 remoting.AppRemoting.prototype.getActivity = function() {
89 return this.activity_;
90 };
91
92 /**
93 * @param {!remoting.Error} error The failure reason.
94 * @override {remoting.ApplicationInterface}
95 */
96 remoting.AppRemoting.prototype.signInFailed_ = function(error) {
97 remoting.MessageWindow.showErrorMessage(
98 this.getApplicationName(),
99 chrome.i18n.getMessage(error.getTag()));
100 };
101
102 /**
103 * @override {remoting.ApplicationInterface}
104 */
105 remoting.AppRemoting.prototype.initApplication_ = function() {
106 remoting.messageWindowManager = new remoting.MessageWindowManager(
107 /** @type {base.WindowMessageDispatcher} */
108 (this.windowMessageDispatcher_));
109 };
110
111 /**
112 * @param {string} token An OAuth access token.
113 * @override {remoting.ApplicationInterface}
114 */
115 remoting.AppRemoting.prototype.startApplication_ = function(token) {
116 var windowShape = new remoting.WindowShape();
117 windowShape.updateClientWindowShape();
118 var that = this;
119
120 this.licenseManager_.getSubscriptionToken(token).then(
121 function(/** string*/ subscriptionToken) {
122 that.activity_ = new remoting.AppRemotingActivity(
123 that.appCapabilities_, that, windowShape, subscriptionToken,
124 /** @type {base.WindowMessageDispatcher} */
125 (that.windowMessageDispatcher_));
126 that.activity_.start();
127 });
128 };
129
130 /**
131 * @override {remoting.ApplicationInterface}
132 */
133 remoting.AppRemoting.prototype.exitApplication_ = function() {
134 if (this.activity_) {
135 this.activity_.stop();
136 this.activity_.dispose();
137 this.activity_ = null;
138 }
139 this.closeMainWindow_();
140 };
OLDNEW
« no previous file with comments | « remoting/webapp/app_remoting/js/app_connected_view.js ('k') | remoting/webapp/app_remoting/js/app_remoting_activity.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698