diff options
Diffstat (limited to 'remoting/host/plugin/host_script_object.cc')
-rw-r--r-- | remoting/host/plugin/host_script_object.cc | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/remoting/host/plugin/host_script_object.cc b/remoting/host/plugin/host_script_object.cc index f9a8299..9b78eb3 100644 --- a/remoting/host/plugin/host_script_object.cc +++ b/remoting/host/plugin/host_script_object.cc @@ -18,7 +18,6 @@ #include "net/base/net_util.h" #include "remoting/base/auth_token_util.h" #include "remoting/base/auto_thread.h" -#include "remoting/base/resources.h" #include "remoting/base/rsa_key_pair.h" #include "remoting/host/chromoting_host.h" #include "remoting/host/chromoting_host_context.h" @@ -105,7 +104,8 @@ class HostNPScriptObject::It2MeImpl // Creates It2Me host structures and starts the host. void Connect(const std::string& uid, const std::string& auth_token, - const std::string& auth_service); + const std::string& auth_service, + const UiStrings& ui_strings); // Disconnects the host, ready for tear-down. // Also called internally, from the network thread. @@ -222,19 +222,22 @@ HostNPScriptObject::It2MeImpl::It2MeImpl( void HostNPScriptObject::It2MeImpl::Connect( const std::string& uid, const std::string& auth_token, - const std::string& auth_service) { + const std::string& auth_service, + const UiStrings& ui_strings) { if (!host_context_->ui_task_runner()->BelongsToCurrentThread()) { DCHECK(plugin_task_runner_->BelongsToCurrentThread()); host_context_->ui_task_runner()->PostTask( FROM_HERE, - base::Bind(&It2MeImpl::Connect, this, uid, auth_token, auth_service)); + base::Bind(&It2MeImpl::Connect, this, uid, auth_token, auth_service, + ui_strings)); return; } desktop_environment_factory_.reset(new It2MeDesktopEnvironmentFactory( host_context_->network_task_runner(), host_context_->input_task_runner(), - host_context_->ui_task_runner())); + host_context_->ui_task_runner(), + ui_strings)); // Start monitoring configured policies. policy_watcher_.reset( @@ -1053,7 +1056,7 @@ bool HostNPScriptObject::Connect(const NPVariant* args, it2me_impl_ = new It2MeImpl( host_context.Pass(), plugin_task_runner_, weak_ptr_, xmpp_server_config_, directory_bot_jid_); - it2me_impl_->Connect(uid, auth_token, auth_service); + it2me_impl_->Connect(uid, auth_token, auth_service, ui_strings_); return true; } @@ -1493,13 +1496,23 @@ void HostNPScriptObject::SetWindow(NPWindow* np_window) { void HostNPScriptObject::LocalizeStrings(NPObject* localize_func) { DCHECK(plugin_task_runner_->BelongsToCurrentThread()); - // Reload resources for the current locale. The default UI locale is used on - // Windows. -#if !defined(OS_WIN) - string16 ui_locale; - LocalizeString(localize_func, "@@ui_locale", &ui_locale); - remoting::LoadResources(UTF16ToUTF8(ui_locale)); -#endif // !defined(OS_WIN) + string16 direction; + LocalizeString(localize_func, "@@bidi_dir", &direction); + ui_strings_.direction = UTF16ToUTF8(direction) == "rtl" ? + remoting::UiStrings::RTL : remoting::UiStrings::LTR; + LocalizeString(localize_func, /*i18n-content*/"PRODUCT_NAME", + &ui_strings_.product_name); + LocalizeString(localize_func, /*i18n-content*/"DISCONNECT_OTHER_BUTTON", + &ui_strings_.disconnect_button_text); + LocalizeString(localize_func, /*i18n-content*/"CONTINUE_PROMPT", + &ui_strings_.continue_prompt); + LocalizeString(localize_func, /*i18n-content*/"CONTINUE_BUTTON", + &ui_strings_.continue_button_text); + LocalizeString(localize_func, /*i18n-content*/"STOP_SHARING_BUTTON", + &ui_strings_.stop_sharing_button_text); + LocalizeStringWithSubstitution(localize_func, + /*i18n-content*/"MESSAGE_SHARED", "$1", + &ui_strings_.disconnect_message); } bool HostNPScriptObject::LocalizeString(NPObject* localize_func, |