Index: remoting/host/plugin/host_script_object.h |
diff --git a/remoting/host/plugin/host_script_object.h b/remoting/host/plugin/host_script_object.h |
index 9172ada94d6d48e908c7b1b1c48aa15e7e5f3ec7..b67097ab74dbac52706617d92177a2081538bf4b 100644 |
--- a/remoting/host/plugin/host_script_object.h |
+++ b/remoting/host/plugin/host_script_object.h |
@@ -12,6 +12,7 @@ |
#include "base/memory/scoped_ptr.h" |
#include "base/memory/ref_counted.h" |
#include "base/synchronization/cancellation_flag.h" |
+#include "base/synchronization/lock.h" |
#include "base/synchronization/waitable_event.h" |
#include "base/string16.h" |
#include "base/threading/platform_thread.h" |
@@ -20,6 +21,7 @@ |
#include "remoting/host/chromoting_host_context.h" |
#include "remoting/host/host_status_observer.h" |
#include "remoting/host/plugin/host_plugin_utils.h" |
+#include "remoting/host/ui_strings.h" |
#include "third_party/npapi/bindings/npapi.h" |
#include "third_party/npapi/bindings/npfunctions.h" |
#include "third_party/npapi/bindings/npruntime.h" |
@@ -102,6 +104,12 @@ class HostNPScriptObject : public HostStatusObserver { |
// Disconnect. No arguments or result. |
bool Disconnect(const NPVariant* args, uint32_t argCount, NPVariant* result); |
+ // Localize strings. args are: |
+ // localize_func - a callback function which returns a localized string for |
+ // a given tag name. |
+ // No result. |
+ bool Localize(const NPVariant* args, uint32_t argCount, NPVariant* result); |
+ |
// Call OnStateChanged handler if there is one. |
void OnStateChanged(State state); |
@@ -130,13 +138,14 @@ class HostNPScriptObject : public HostStatusObserver { |
// Called when the nat traversal policy is updated. |
void OnNatPolicyUpdate(bool nat_traversal_enabled); |
- void LocalizeStrings(); |
+ void LocalizeStrings(NPObject* localize_func); |
// Helper function for executing InvokeDefault on an NPObject that performs |
// a string->string mapping with one optional substitution parameter. Stores |
// the translation in |result| and returns true on success, or leaves it |
// unchanged and returns false on failure. |
- bool LocalizeString(const char* tag, string16* result); |
+ bool LocalizeString(NPObject* localize_func, const char* tag, |
+ string16* result); |
// Helper function for executing InvokeDefault on an NPObject, and ignoring |
// the return value. |
@@ -153,7 +162,6 @@ class HostNPScriptObject : public HostStatusObserver { |
std::string access_code_; |
std::string client_username_; |
base::TimeDelta access_code_lifetime_; |
- ScopedRefNPObject localize_func_; |
ScopedRefNPObject log_debug_info_func_; |
ScopedRefNPObject on_state_changed_func_; |
base::PlatformThreadId np_thread_id_; |
@@ -167,6 +175,9 @@ class HostNPScriptObject : public HostStatusObserver { |
scoped_refptr<ChromotingHost> host_; |
int failed_login_attempts_; |
+ UiStrings ui_strings_; |
+ base::Lock ui_strings_lock_; |
+ |
base::WaitableEvent disconnected_event_; |
scoped_ptr<policy_hack::NatPolicy> nat_policy_; |