OLD | NEW |
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 */ |
11 remoting.HostController = function() { | 11 remoting.HostController = function() { |
12 /** @return {remoting.HostPlugin} */ | 12 /** @return {remoting.HostPlugin} */ |
13 var createPluginForMe2Me = function() { | 13 var createPluginForMe2Me = function() { |
14 var plugin = remoting.HostSession.createPlugin(); | 14 var plugin = remoting.HostSession.createPlugin(); |
15 /** @type {HTMLElement} @private */ | 15 /** @type {HTMLElement} @private */ |
16 var container = document.getElementById('daemon-plugin-container'); | 16 var container = document.getElementById('daemon-plugin-container'); |
17 container.appendChild(plugin); | 17 container.appendChild(plugin); |
| 18 if (plugin.hasOwnProperty('REQUESTED_ACCESS_CODE')) { |
| 19 container.removeChild(plugin); |
| 20 return null; |
| 21 } |
18 return plugin; | 22 return plugin; |
19 }; | 23 }; |
20 | 24 |
21 /** @type {remoting.HostDispatcher} @private */ | 25 /** @type {remoting.HostDispatcher} @private */ |
22 this.hostDispatcher_ = new remoting.HostDispatcher(createPluginForMe2Me); | 26 this.hostDispatcher_ = new remoting.HostDispatcher(createPluginForMe2Me); |
23 | 27 |
24 /** @param {string} version */ | 28 /** @param {string} version */ |
25 var printVersion = function(version) { | 29 var printVersion = function(version) { |
26 if (version == '') { | 30 if (version == '') { |
27 console.log('Host not installed.'); | 31 console.log('Host not installed.'); |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 * | 469 * |
466 * @param {function():void} onDone Completion callback. | 470 * @param {function():void} onDone Completion callback. |
467 * @param {function(remoting.Error):void} onError Error callback. | 471 * @param {function(remoting.Error):void} onError Error callback. |
468 * @return {void} | 472 * @return {void} |
469 */ | 473 */ |
470 remoting.HostController.prototype.clearPairedClients = function( | 474 remoting.HostController.prototype.clearPairedClients = function( |
471 onDone, onError) { | 475 onDone, onError) { |
472 this.hostDispatcher_.clearPairedClients(onDone, onError); | 476 this.hostDispatcher_.clearPairedClients(onDone, onError); |
473 }; | 477 }; |
474 | 478 |
| 479 /** |
| 480 * Returns true if the NPAPI plugin is being used. |
| 481 * @return {boolean} |
| 482 */ |
| 483 remoting.HostController.prototype.usingNpapiPlugin = function() { |
| 484 return this.hostDispatcher_.usingNpapiPlugin(); |
| 485 } |
| 486 |
475 /** @type {remoting.HostController} */ | 487 /** @type {remoting.HostController} */ |
476 remoting.hostController = null; | 488 remoting.hostController = null; |
OLD | NEW |