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

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

Issue 1163023002: [AppRemoting] Implements LicenseManager. (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 * @param {Array<string>} appCapabilities Array of application capabilities.
18 * @param {!remoting.LicenseManager} licenseManager
18 * @constructor 19 * @constructor
19 * @implements {remoting.ApplicationInterface} 20 * @implements {remoting.ApplicationInterface}
20 * @extends {remoting.Application} 21 * @extends {remoting.Application}
21 */ 22 */
22 remoting.AppRemoting = function(appCapabilities) { 23 remoting.AppRemoting = function(appCapabilities, licenseManager) {
23 base.inherits(this, remoting.Application); 24 base.inherits(this, remoting.Application);
24 25
25 /** @private {remoting.Activity} */ 26 /** @private {remoting.Activity} */
26 this.activity_ = null; 27 this.activity_ = null;
27 28
28 /** @private */ 29 /** @private */
30 this.licenseManager_ = licenseManager;
31
32 /** @private */
29 this.appCapabilities_ = appCapabilities; 33 this.appCapabilities_ = appCapabilities;
30 }; 34 };
31 35
32 /** 36 /**
33 * @return {string} Application product name to be used in UI. 37 * @return {string} Application product name to be used in UI.
34 * @override {remoting.ApplicationInterface} 38 * @override {remoting.ApplicationInterface}
35 */ 39 */
36 remoting.AppRemoting.prototype.getApplicationName = function() { 40 remoting.AppRemoting.prototype.getApplicationName = function() {
37 var manifest = chrome.runtime.getManifest(); 41 var manifest = chrome.runtime.getManifest();
38 return manifest.name; 42 return manifest.name;
39 }; 43 };
40 44
41 remoting.AppRemoting.prototype.getActivity = function() { 45 remoting.AppRemoting.prototype.getActivity = function() {
42 return this.activity_; 46 return this.activity_;
43 }; 47 };
44 48
45 /** 49 /**
46 * @param {!remoting.Error} error The failure reason. 50 * @param {!remoting.Error} error The failure reason.
47 * @override {remoting.ApplicationInterface} 51 * @override {remoting.ApplicationInterface}
48 */ 52 */
49 remoting.AppRemoting.prototype.signInFailed_ = function(error) { 53 remoting.AppRemoting.prototype.signInFailed_ = function(error) {
50 remoting.MessageWindow.showErrorMessage( 54 remoting.MessageWindow.showErrorMessage(
51 this.getApplicationName(), 55 this.getApplicationName(),
52 chrome.i18n.getMessage(error.getTag())); 56 chrome.i18n.getMessage(error.getTag()));
53 }; 57 };
54 58
55 /** 59 /**
56 * @override {remoting.ApplicationInterface} 60 * @override {remoting.ApplicationInterface}
57 */ 61 */
58 remoting.AppRemoting.prototype.initApplication_ = function() { 62 remoting.AppRemoting.prototype.initApplication_ = function() {};
59 var windowShape = new remoting.WindowShape();
60 windowShape.updateClientWindowShape();
61
62 this.activity_ = new remoting.AppRemotingActivity(this.appCapabilities_, this,
63 windowShape);
64 };
65 63
66 /** 64 /**
67 * @param {string} token An OAuth access token. 65 * @param {string} token An OAuth access token.
68 * @override {remoting.ApplicationInterface} 66 * @override {remoting.ApplicationInterface}
69 */ 67 */
70 remoting.AppRemoting.prototype.startApplication_ = function(token) { 68 remoting.AppRemoting.prototype.startApplication_ = function(token) {
71 this.activity_.start(); 69 var windowShape = new remoting.WindowShape();
70 windowShape.updateClientWindowShape();
71 var that = this;
72
73 this.licenseManager_.getSubscriptionToken(token).then(
garykac 2015/06/04 22:13:43 We should allow licenseManager go be null and simp
kelvinp 2015/06/05 20:45:20 Good idea. Done
74 function(/** string*/ subscriptionToken) {
75 that.activity_ = new remoting.AppRemotingActivity(
76 that.appCapabilities_, that, windowShape, subscriptionToken);
77 that.activity_.start();
78 });
72 }; 79 };
73 80
74 /** 81 /**
75 * @override {remoting.ApplicationInterface} 82 * @override {remoting.ApplicationInterface}
76 */ 83 */
77 remoting.AppRemoting.prototype.exitApplication_ = function() { 84 remoting.AppRemoting.prototype.exitApplication_ = function() {
78 this.activity_.dispose(); 85 this.activity_.dispose();
79 this.closeMainWindow_(); 86 this.closeMainWindow_();
80 }; 87 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698