OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 provides an interface between the HostController and either the | 7 * This class provides an interface between the HostController and either the |
8 * NativeMessaging Host or the Host NPAPI plugin, depending on whether or not | 8 * NativeMessaging Host or the Host NPAPI plugin, depending on whether or not |
9 * NativeMessaging is supported. Since the test for NativeMessaging support is | 9 * NativeMessaging is supported. Since the test for NativeMessaging support is |
10 * asynchronous, this class stores any requests on a queue, pending the result | 10 * asynchronous, this class stores any requests on a queue, pending the result |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
80 that.state_ = that.npapiHost_ ? remoting.HostDispatcher.State.NPAPI | 80 that.state_ = that.npapiHost_ ? remoting.HostDispatcher.State.NPAPI |
81 : remoting.HostDispatcher.State.NOT_INSTALLED; | 81 : remoting.HostDispatcher.State.NOT_INSTALLED; |
82 sendPendingRequests(); | 82 sendPendingRequests(); |
83 } | 83 } |
84 | 84 |
85 this.nativeMessagingHost_.initialize(onNativeMessagingInit, | 85 this.nativeMessagingHost_.initialize(onNativeMessagingInit, |
86 onNativeMessagingFailed); | 86 onNativeMessagingFailed); |
87 }; | 87 }; |
88 | 88 |
89 /** | 89 /** |
90 * @return {remoting.HostPlugin} | |
91 */ | |
92 remoting.HostDispatcher.prototype.getNpapiHost = function() { | |
Jamie
2014/05/20 21:43:06
I don't like the host dispatcher exposing one of i
weitao
2014/05/20 22:09:13
I do plan to remove this in the subsequent CL's wh
| |
93 return this.npapiHost_; | |
94 } | |
95 | |
96 /** | |
90 * @param {remoting.HostController.Feature} feature The feature to test for. | 97 * @param {remoting.HostController.Feature} feature The feature to test for. |
91 * @param {function(boolean):void} onDone | 98 * @param {function(boolean):void} onDone |
92 * @return {void} | 99 * @return {void} |
93 */ | 100 */ |
94 remoting.HostDispatcher.prototype.hasFeature = function( | 101 remoting.HostDispatcher.prototype.hasFeature = function( |
95 feature, onDone) { | 102 feature, onDone) { |
96 switch (this.state_) { | 103 switch (this.state_) { |
97 case remoting.HostDispatcher.State.UNKNOWN: | 104 case remoting.HostDispatcher.State.UNKNOWN: |
98 this.pendingRequests_.push( | 105 this.pendingRequests_.push( |
99 this.hasFeature.bind(this, feature, onDone)); | 106 this.hasFeature.bind(this, feature, onDone)); |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
380 onError(remoting.Error.MISSING_PLUGIN); | 387 onError(remoting.Error.MISSING_PLUGIN); |
381 } | 388 } |
382 break; | 389 break; |
383 case remoting.HostDispatcher.State.NOT_INSTALLED: | 390 case remoting.HostDispatcher.State.NOT_INSTALLED: |
384 onError(remoting.Error.MISSING_PLUGIN); | 391 onError(remoting.Error.MISSING_PLUGIN); |
385 break; | 392 break; |
386 } | 393 } |
387 }; | 394 }; |
388 | 395 |
389 /** | 396 /** |
397 * This function installs the chromoting host using the NPAPI plugin and should | |
Jamie
2014/05/20 21:43:06
Nit: We shouldn't refer to "chromoting" in our sou
weitao
2014/05/20 22:09:13
Done.
| |
398 * only be called on Windows. | |
399 * | |
390 * @param {function(remoting.HostController.AsyncResult):void} onDone | 400 * @param {function(remoting.HostController.AsyncResult):void} onDone |
391 * @param {function(remoting.Error):void} onError | 401 * @param {function(remoting.Error):void} onError |
392 * @return {void} | 402 * @return {void} |
393 */ | 403 */ |
394 remoting.HostDispatcher.prototype.stopDaemon = function(onDone, onError) { | 404 remoting.HostDispatcher.prototype.stopDaemon = function(onDone, onError) { |
395 switch (this.state_) { | 405 switch (this.state_) { |
396 case remoting.HostDispatcher.State.UNKNOWN: | 406 case remoting.HostDispatcher.State.UNKNOWN: |
397 this.pendingRequests_.push(this.stopDaemon.bind(this, onDone, onError)); | 407 this.pendingRequests_.push(this.stopDaemon.bind(this, onDone, onError)); |
398 break; | 408 break; |
399 case remoting.HostDispatcher.State.NATIVE_MESSAGING: | 409 case remoting.HostDispatcher.State.NATIVE_MESSAGING: |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
636 } | 646 } |
637 }; | 647 }; |
638 | 648 |
639 /** | 649 /** |
640 * Returns true if the NPAPI plugin is being used. | 650 * Returns true if the NPAPI plugin is being used. |
641 * @return {boolean} | 651 * @return {boolean} |
642 */ | 652 */ |
643 remoting.HostDispatcher.prototype.usingNpapiPlugin = function() { | 653 remoting.HostDispatcher.prototype.usingNpapiPlugin = function() { |
644 return this.state_ == remoting.HostDispatcher.State.NPAPI; | 654 return this.state_ == remoting.HostDispatcher.State.NPAPI; |
645 } | 655 } |
OLD | NEW |