diff options
-rw-r--r-- | remoting/host/plugin/host_script_object.cc | 6 | ||||
-rw-r--r-- | remoting/webapp/me2mom/remoting.js | 11 |
2 files changed, 11 insertions, 6 deletions
diff --git a/remoting/host/plugin/host_script_object.cc b/remoting/host/plugin/host_script_object.cc index 9dc8534..1838cf0 100644 --- a/remoting/host/plugin/host_script_object.cc +++ b/remoting/host/plugin/host_script_object.cc @@ -42,7 +42,7 @@ namespace remoting { // // attribute Function void logDebugInfo(string); // attribute Function void onNatTraversalPolicyChanged(boolean); -// attribute Function void onStateChanged(); +// attribute Function void onStateChanged(state); // // // The |auth_service_with_token| parameter should be in the format // // "auth_service:auth_token". An example would be "oauth2:1/2a3912vd". @@ -701,8 +701,10 @@ void HostNPScriptObject::NotifyStateChanged(State state) { } if (on_state_changed_func_.get()) { VLOG(2) << "Calling state changed " << state; + NPVariant state_var; + INT32_TO_NPVARIANT(state, state_var); bool is_good = InvokeAndIgnoreResult(on_state_changed_func_.get(), - NULL, 0); + &state_var, 1); LOG_IF(ERROR, !is_good) << "OnStateChanged failed"; } } diff --git a/remoting/webapp/me2mom/remoting.js b/remoting/webapp/me2mom/remoting.js index 3690eb1..6139cd2 100644 --- a/remoting/webapp/me2mom/remoting.js +++ b/remoting/webapp/me2mom/remoting.js @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +'use strict'; + /** @suppress {duplicate} */ var remoting = remoting || {}; -'use strict'; - /** * Whether or not the plugin should scale itself. * @type {boolean} @@ -353,10 +353,13 @@ function onNatTraversalPolicyChanged_(enabled) { container.hidden = enabled; } -function onStateChanged_() { +/** + * Callback for the host plugin to notify the web app of state changes. + * @param {number} state The new state of the plugin. + */ +function onStateChanged_(state) { var plugin = /** @type {remoting.HostPlugin} */ document.getElementById(remoting.HOST_PLUGIN_ID); - var state = plugin.state; if (state == plugin.STARTING) { // Nothing to do here. remoting.debug.log('Host plugin state: STARTING'); |