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

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

Issue 10661058: Move responsibility for l10n parameters to the caller. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed parameter name. Created 8 years, 6 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/webapp/host_session.js » ('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 dc6c450e4baa688c5aabb34204c7a367ecb7f863..b4d3ab10a8c2eeac2326963f4a1a22e9e2015442 100644
--- a/remoting/host/plugin/host_script_object.cc
+++ b/remoting/host/plugin/host_script_object.cc
@@ -1051,8 +1051,9 @@ void HostNPScriptObject::LocalizeStrings(NPObject* localize_func) {
&ui_strings.continue_button_text);
LocalizeString(localize_func, /*i18n-content*/"STOP_SHARING_BUTTON",
&ui_strings.stop_sharing_button_text);
- LocalizeString(localize_func, /*i18n-content*/"MESSAGE_SHARED",
- &ui_strings.disconnect_message);
+ LocalizeStringWithSubstitution(localize_func,
+ /*i18n-content*/"MESSAGE_SHARED", "$1",
Sergey Ulanov 2012/06/29 20:11:38 nit: incorrect indentation.
Jamie 2012/06/29 20:22:20 Done.
+ &ui_strings.disconnect_message);
base::AutoLock auto_lock(ui_strings_lock_);
ui_strings_ = ui_strings;
@@ -1060,11 +1061,21 @@ void HostNPScriptObject::LocalizeStrings(NPObject* localize_func) {
bool HostNPScriptObject::LocalizeString(NPObject* localize_func,
const char* tag, string16* result) {
- NPVariant args[2];
+ return LocalizeStringWithSubstitution(localize_func, tag, NULL, result);
+}
+
+bool HostNPScriptObject::LocalizeStringWithSubstitution(
+ NPObject* localize_func, const char* tag, const char* substitution,
Sergey Ulanov 2012/06/29 20:11:38 nit: move each argument to a separate line
Jamie 2012/06/29 20:22:20 Done.
+ string16* result) {
+ int argc = substitution ? 2 : 1;
+ scoped_array<NPVariant> args(new NPVariant[argc]);
STRINGZ_TO_NPVARIANT(tag, args[0]);
+ if (substitution) {
Sergey Ulanov 2012/06/29 20:11:38 nit: don't need {} here
Jamie 2012/06/29 20:22:20 We're inconsistent wrt this, even within this file
+ STRINGZ_TO_NPVARIANT(substitution, args[1]);
+ }
NPVariant np_result;
bool is_good = g_npnetscape_funcs->invokeDefault(
- plugin_, localize_func, &args[0], 1, &np_result);
+ plugin_, localize_func, args.get(), argc, &np_result);
if (!is_good) {
LOG(ERROR) << "Localization failed for " << tag;
return false;
« no previous file with comments | « remoting/host/plugin/host_script_object.h ('k') | remoting/webapp/host_session.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698