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

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

Issue 340993002: Revert of Remove NPAPI plugin from chromoting webapp. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « remoting/webapp/build-webapp.py ('k') | remoting/webapp/host_dispatcher.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 'use strict'; 5 'use strict';
6 6
7 /** @suppress {duplicate} */ 7 /** @suppress {duplicate} */
8 var remoting = remoting || {}; 8 var remoting = remoting || {};
9 9
10 /** @constructor */ 10 /** @constructor */
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 throw "Invalid HostController.AsyncResult: " + result; 61 throw "Invalid HostController.AsyncResult: " + result;
62 } 62 }
63 return remoting.HostController.AsyncResult[result]; 63 return remoting.HostController.AsyncResult[result];
64 } 64 }
65 65
66 /** 66 /**
67 * @return {remoting.HostDispatcher} 67 * @return {remoting.HostDispatcher}
68 * @private 68 * @private
69 */ 69 */
70 remoting.HostController.prototype.createDispatcher_ = function() { 70 remoting.HostController.prototype.createDispatcher_ = function() {
71 /** @return {remoting.HostPlugin} */
72 var createPluginForMe2Me = function() {
73 /** @type {HTMLElement} @private */
74 var container = document.getElementById('daemon-plugin-container');
75 return remoting.createNpapiPlugin(container);
76 };
77
71 /** @type {remoting.HostDispatcher} @private */ 78 /** @type {remoting.HostDispatcher} @private */
72 var hostDispatcher = new remoting.HostDispatcher(); 79 var hostDispatcher = new remoting.HostDispatcher(createPluginForMe2Me);
73 80
74 /** @param {string} version */ 81 /** @param {string} version */
75 var printVersion = function(version) { 82 var printVersion = function(version) {
76 if (version == '') { 83 if (version == '') {
77 console.log('Host not installed.'); 84 console.log('Host not installed.');
78 } else { 85 } else {
79 console.log('Host version: ' + version); 86 console.log('Host version: ' + version);
80 } 87 }
81 }; 88 };
82 89
(...skipping 29 matching lines...) Expand all
112 * @param {function(boolean, boolean, boolean):void} onDone Callback to be 119 * @param {function(boolean, boolean, boolean):void} onDone Callback to be
113 * called when done. 120 * called when done.
114 * @param {function(remoting.Error):void} onError Callback to be called on 121 * @param {function(remoting.Error):void} onError Callback to be called on
115 * error. 122 * error.
116 */ 123 */
117 remoting.HostController.prototype.getConsent = function(onDone, onError) { 124 remoting.HostController.prototype.getConsent = function(onDone, onError) {
118 this.hostDispatcher_.getUsageStatsConsent(onDone, onError); 125 this.hostDispatcher_.getUsageStatsConsent(onDone, onError);
119 }; 126 };
120 127
121 /** 128 /**
129 * @param {function(remoting.HostController.AsyncResult):void} onDone
130 * @param {function(remoting.Error):void} onError
131 * @return {void}
132 */
133 remoting.HostController.prototype.installHost = function(onDone, onError) {
134 /** @type {remoting.HostController} */
135 var that = this;
136
137 /** @param {remoting.HostController.AsyncResult} asyncResult */
138 var onHostInstalled = function(asyncResult) {
139 // Refresh the dispatcher after the host has been installed.
140 if (asyncResult == remoting.HostController.AsyncResult.OK) {
141 that.hostDispatcher_ = that.createDispatcher_();
142 }
143 onDone(asyncResult);
144 };
145
146 this.hostDispatcher_.installHost(onHostInstalled, onError);
147 };
148
149 /**
122 * Registers and starts the host. 150 * Registers and starts the host.
123 * 151 *
124 * @param {string} hostPin Host PIN. 152 * @param {string} hostPin Host PIN.
125 * @param {boolean} consent The user's consent to crash dump reporting. 153 * @param {boolean} consent The user's consent to crash dump reporting.
126 * @param {function():void} onDone Callback to be called when done. 154 * @param {function():void} onDone Callback to be called when done.
127 * @param {function(remoting.Error):void} onError Callback to be called on 155 * @param {function(remoting.Error):void} onError Callback to be called on
128 * error. 156 * error.
129 * @return {void} Nothing. 157 * @return {void} Nothing.
130 */ 158 */
131 remoting.HostController.prototype.start = function(hostPin, consent, onDone, 159 remoting.HostController.prototype.start = function(hostPin, consent, onDone,
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 * 523 *
496 * @param {function():void} onDone Completion callback. 524 * @param {function():void} onDone Completion callback.
497 * @param {function(remoting.Error):void} onError Error callback. 525 * @param {function(remoting.Error):void} onError Error callback.
498 * @return {void} 526 * @return {void}
499 */ 527 */
500 remoting.HostController.prototype.clearPairedClients = function( 528 remoting.HostController.prototype.clearPairedClients = function(
501 onDone, onError) { 529 onDone, onError) {
502 this.hostDispatcher_.clearPairedClients(onDone, onError); 530 this.hostDispatcher_.clearPairedClients(onDone, onError);
503 }; 531 };
504 532
533 /**
534 * Returns true if the NPAPI plugin is being used.
535 * @return {boolean}
536 */
537 remoting.HostController.prototype.usingNpapiPlugin = function() {
538 return this.hostDispatcher_.usingNpapiPlugin();
539 }
540
505 /** @type {remoting.HostController} */ 541 /** @type {remoting.HostController} */
506 remoting.hostController = null; 542 remoting.hostController = null;
OLDNEW
« no previous file with comments | « remoting/webapp/build-webapp.py ('k') | remoting/webapp/host_dispatcher.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698