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

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

Issue 7669045: Make ChromotingHost::ui_strings() immutable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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
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 9f6bbfcea19ab54ac2c91674ea90493202dc53c7..ec3b94b0b3c9f554d1a079e5f9cd488c8a7c7384 100644
--- a/remoting/host/plugin/host_script_object.cc
+++ b/remoting/host/plugin/host_script_object.cc
@@ -350,7 +350,6 @@ void HostNPScriptObject::OnClientAuthenticated(
if (pos != std::string::npos)
client_username_.replace(pos, std::string::npos, "");
LOG(INFO) << "Client " << client_username_ << " connected.";
- LocalizeStrings();
OnStateChanged(kConnected);
}
@@ -482,6 +481,8 @@ void HostNPScriptObject::FinishConnect(
host_->AddStatusObserver(register_request_.get());
host_->set_it2me(true);
+ LocalizeStrings();
Jamie 2011/08/18 16:28:41 Do we know the username at this point? Your object
Sergey Ulanov 2011/08/18 18:04:32 I updated DisconnectWindow to substitute user name
+
// Start the Host.
host_->Start();
@@ -642,14 +643,14 @@ void HostNPScriptObject::SetException(const std::string& exception_string) {
}
void HostNPScriptObject::LocalizeStrings() {
- UiStrings* ui_strings = host_->ui_strings();
+ UiStrings ui_strings;
std::string direction;
LocalizeString("@@bidi_dir", NULL, &direction);
- ui_strings->direction =
+ ui_strings.direction =
direction == "rtl" ? remoting::UiStrings::RTL
: remoting::UiStrings::LTR;
- LocalizeString("productName", NULL, &ui_strings->product_name);
- LocalizeString("disconnectButton", NULL, &ui_strings->disconnect_button_text);
+ LocalizeString("productName", NULL, &ui_strings.product_name);
+ LocalizeString("disconnectButton", NULL, &ui_strings.disconnect_button_text);
LocalizeString(
#if defined(OS_WIN)
"disconnectButtonPlusShortcutWindows",
@@ -658,13 +659,15 @@ void HostNPScriptObject::LocalizeStrings() {
#else
"disconnectButtonPlusShortcutLinux",
#endif
- NULL, &ui_strings->disconnect_button_text_plus_shortcut);
- LocalizeString("continuePrompt", NULL, &ui_strings->continue_prompt);
- LocalizeString("continueButton", NULL, &ui_strings->continue_button_text);
+ NULL, &ui_strings.disconnect_button_text_plus_shortcut);
+ LocalizeString("continuePrompt", NULL, &ui_strings.continue_prompt);
+ LocalizeString("continueButton", NULL, &ui_strings.continue_button_text);
LocalizeString("stopSharingButton", NULL,
- &ui_strings->stop_sharing_button_text);
+ &ui_strings.stop_sharing_button_text);
LocalizeString("messageShared", client_username_.c_str(),
- &ui_strings->disconnect_message);
+ &ui_strings.disconnect_message);
+
+ host_->SetUiStrings(ui_strings);
}
bool HostNPScriptObject::LocalizeString(const char* tag,

Powered by Google App Engine
This is Rietveld 408576698