Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(450)

Unified Diff: remoting/host/plugin/host_script_object.cc

Issue 21059003: Localized Chromoting Host on Mac and Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/host/plugin/host_script_object.h ('k') | remoting/host/remoting_me2me_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/plugin/host_script_object.cc
diff --git a/remoting/host/plugin/host_script_object.cc b/remoting/host/plugin/host_script_object.cc
index 9b78eb3ea63e4d246963f2559e832cd4fa1b1864..f9a82996c6415d338fec3c81198ba1614c880128 100644
--- a/remoting/host/plugin/host_script_object.cc
+++ b/remoting/host/plugin/host_script_object.cc
@@ -18,6 +18,7 @@
#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"
@@ -104,8 +105,7 @@ 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 UiStrings& ui_strings);
+ const std::string& auth_service);
// Disconnects the host, ready for tear-down.
// Also called internally, from the network thread.
@@ -222,22 +222,19 @@ HostNPScriptObject::It2MeImpl::It2MeImpl(
void HostNPScriptObject::It2MeImpl::Connect(
const std::string& uid,
const std::string& auth_token,
- const std::string& auth_service,
- const UiStrings& ui_strings) {
+ const std::string& auth_service) {
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,
- ui_strings));
+ base::Bind(&It2MeImpl::Connect, this, uid, auth_token, auth_service));
return;
}
desktop_environment_factory_.reset(new It2MeDesktopEnvironmentFactory(
host_context_->network_task_runner(),
host_context_->input_task_runner(),
- host_context_->ui_task_runner(),
- ui_strings));
+ host_context_->ui_task_runner()));
// Start monitoring configured policies.
policy_watcher_.reset(
@@ -1056,7 +1053,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, ui_strings_);
+ it2me_impl_->Connect(uid, auth_token, auth_service);
return true;
}
@@ -1496,23 +1493,13 @@ void HostNPScriptObject::SetWindow(NPWindow* np_window) {
void HostNPScriptObject::LocalizeStrings(NPObject* localize_func) {
DCHECK(plugin_task_runner_->BelongsToCurrentThread());
- 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);
+ // 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)
}
bool HostNPScriptObject::LocalizeString(NPObject* localize_func,
« no previous file with comments | « remoting/host/plugin/host_script_object.h ('k') | remoting/host/remoting_me2me_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698