summaryrefslogtreecommitdiffstats
path: root/remoting/host/continue_window_linux.cc
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-18 22:19:23 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-18 22:19:23 +0000
commit8b65ba9961e94706d8b0833638d0ef99b95b3b43 (patch)
tree1ccb150aee4b1a1ef414cf4a2d474f977b7d1e71 /remoting/host/continue_window_linux.cc
parent352a797d3022450c4e5ee0e25a7d30cb414632da (diff)
downloadchromium_src-8b65ba9961e94706d8b0833638d0ef99b95b3b43.zip
chromium_src-8b65ba9961e94706d8b0833638d0ef99b95b3b43.tar.gz
chromium_src-8b65ba9961e94706d8b0833638d0ef99b95b3b43.tar.bz2
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
Diffstat (limited to 'remoting/host/continue_window_linux.cc')
-rw-r--r--remoting/host/continue_window_linux.cc16
1 files changed, 10 insertions, 6 deletions
diff --git a/remoting/host/continue_window_linux.cc b/remoting/host/continue_window_linux.cc
index 3933f21..431144d 100644
--- a/remoting/host/continue_window_linux.cc
+++ b/remoting/host/continue_window_linux.cc
@@ -8,6 +8,7 @@
#include "base/compiler_specific.h"
#include "base/logging.h"
+#include "base/utf_string_conversions.h"
#include "remoting/host/chromoting_host.h"
#include "remoting/host/ui_strings.h"
#include "ui/base/gtk/gtk_signal.h"
@@ -25,7 +26,7 @@ class ContinueWindowLinux : public remoting::ContinueWindow {
private:
CHROMEGTK_CALLBACK_1(ContinueWindowLinux, void, OnResponse, int);
- void CreateWindow(UiStrings* ui_strings);
+ void CreateWindow(const UiStrings& ui_strings);
ChromotingHost* host_;
GtkWidget* continue_window_;
@@ -41,15 +42,17 @@ ContinueWindowLinux::ContinueWindowLinux()
ContinueWindowLinux::~ContinueWindowLinux() {
}
-void ContinueWindowLinux::CreateWindow(UiStrings* ui_strings) {
+void ContinueWindowLinux::CreateWindow(const UiStrings& ui_strings) {
if (continue_window_) return;
continue_window_ = gtk_dialog_new_with_buttons(
- ui_strings->product_name.c_str(),
+ UTF16ToUTF8(ui_strings.product_name).c_str(),
NULL,
static_cast<GtkDialogFlags>(GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR),
- ui_strings->stop_sharing_button_text.c_str(), GTK_RESPONSE_CANCEL,
- ui_strings->continue_button_text.c_str(), GTK_RESPONSE_OK,
+ UTF16ToUTF8(ui_strings.stop_sharing_button_text).c_str(),
+ GTK_RESPONSE_CANCEL,
+ UTF16ToUTF8(ui_strings.continue_button_text).c_str(),
+ GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_default_response(GTK_DIALOG(continue_window_),
@@ -66,7 +69,8 @@ void ContinueWindowLinux::CreateWindow(UiStrings* ui_strings) {
GtkWidget* content_area =
gtk_dialog_get_content_area(GTK_DIALOG(continue_window_));
- GtkWidget* text_label = gtk_label_new(ui_strings->continue_prompt.c_str());
+ GtkWidget* text_label =
+ gtk_label_new(UTF16ToUTF8(ui_strings.continue_prompt).c_str());
gtk_label_set_line_wrap(GTK_LABEL(text_label), TRUE);
// TODO(lambroslambrou): Fix magic numbers, as in disconnect_window_linux.cc.
gtk_misc_set_padding(GTK_MISC(text_label), 12, 12);