From 8b65ba9961e94706d8b0833638d0ef99b95b3b43 Mon Sep 17 00:00:00 2001 From: "sergeyu@chromium.org" Date: Thu, 18 Aug 2011 22:19:23 +0000 Subject: Make ChromotingHost::ui_strings() immutable. Use string16 for localized strings. There were two issues: - ui_strings() were mutable which creates possibility for race condition. Made it immutable, and added SetUiString() which can be called only before session is started. - strings were loaded after host is started which sometimes leads to non-localized string being shown. Particularly I often saw empty text on Disconnect button. BUG=None TEST=Disconnect button text is always localized. Review URL: http://codereview.chromium.org/7669045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97376 0039d316-1c4b-4281-b951-d872f2087c98 --- remoting/host/ui_strings.cc | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'remoting/host/ui_strings.cc') diff --git a/remoting/host/ui_strings.cc b/remoting/host/ui_strings.cc index 760643f..99c59b3 100644 --- a/remoting/host/ui_strings.cc +++ b/remoting/host/ui_strings.cc @@ -4,24 +4,26 @@ #include "remoting/host/ui_strings.h" +#include "base/utf_string_conversions.h" + namespace remoting { UiStrings::UiStrings() : direction(LTR), - product_name("Chromoting"), - // The default string doesn't include the user name, so this will be - // missing for remoting_simple_host - disconnect_message("Your desktop is currently being shared."), - disconnect_button_text("Disconnect"), + product_name(ASCIIToUTF16("Chromoting")), + disconnect_message( + ASCIIToUTF16("Your desktop is currently being shared with $1.")), + disconnect_button_text(ASCIIToUTF16("Disconnect")), // This is the wrong shortcut on Mac OS X, but remoting_simple_host // doesn't have a bundle (and hence no dialog) on that platform and // the web-app will provide the correct localization for this string. - disconnect_button_shortcut("Ctrl+Alt+Esc"), - continue_prompt( + disconnect_button_text_plus_shortcut( + ASCIIToUTF16("Disconnect (Ctrl+Alt+Esc)")), + continue_prompt(ASCIIToUTF16( "You are currently sharing this machine with another user. " - "Please confirm that you want to continue sharing."), - continue_button_text("Continue"), - stop_sharing_button_text("Stop Sharing") { + "Please confirm that you want to continue sharing.")), + continue_button_text(ASCIIToUTF16("Continue")), + stop_sharing_button_text(ASCIIToUTF16("Stop Sharing")) { } UiStrings::~UiStrings() { } -- cgit v1.1