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

Unified Diff: remoting/host/continue_window_win.cc

Issue 11886051: Turned UiStrings into a singleton so that the continue window does not depend on ChromotingHost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CR feedback Created 7 years, 11 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/continue_window_win.cc
diff --git a/remoting/host/continue_window_win.cc b/remoting/host/continue_window_win.cc
index 8e81439e8e1406175812a648415c8971804d3679..76cc42b0493639631eb30d474ddc57c1bb95f02b 100644
--- a/remoting/host/continue_window_win.cc
+++ b/remoting/host/continue_window_win.cc
@@ -9,8 +9,8 @@
#include "base/compiler_specific.h"
#include "base/logging.h"
#include "base/utf_string_conversions.h"
-#include "remoting/host/chromoting_host.h"
#include "remoting/host/host_ui_resource.h"
+#include "remoting/host/ui_strings.h"
// TODO(garykac): Lots of duplicated code in this file and
// disconnect_window_win.cc. These global floating windows are temporary so
@@ -27,11 +27,10 @@ namespace remoting {
class ContinueWindowWin : public ContinueWindow {
public:
- ContinueWindowWin();
+ explicit ContinueWindowWin(const UiStrings* ui_strings);
virtual ~ContinueWindowWin();
- virtual void Show(remoting::ChromotingHost* host,
- const ContinueSessionCallback& callback) OVERRIDE;
+ virtual void Show(const ContinueSessionCallback& callback) OVERRIDE;
virtual void Hide() OVERRIDE;
private:
@@ -41,18 +40,20 @@ class ContinueWindowWin : public ContinueWindow {
BOOL OnDialogMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
void EndDialog();
- void SetStrings(const UiStrings& strings);
+ void SetStrings();
- remoting::ChromotingHost* host_;
ContinueSessionCallback callback_;
HWND hwnd_;
+ // Points to the localized strings.
+ const UiStrings* ui_strings_;
+
DISALLOW_COPY_AND_ASSIGN(ContinueWindowWin);
};
-ContinueWindowWin::ContinueWindowWin()
- : host_(NULL),
- hwnd_(NULL) {
+ContinueWindowWin::ContinueWindowWin(const UiStrings* ui_strings)
+ : hwnd_(NULL),
+ ui_strings_(ui_strings) {
}
ContinueWindowWin::~ContinueWindowWin() {
@@ -102,9 +103,7 @@ BOOL ContinueWindowWin::OnDialogMessage(HWND hwnd, UINT msg,
return FALSE;
}
-void ContinueWindowWin::Show(ChromotingHost* host,
- const ContinueSessionCallback& callback) {
- host_ = host;
+void ContinueWindowWin::Show(const ContinueSessionCallback& callback) {
callback_ = callback;
CHECK(!hwnd_);
@@ -115,7 +114,7 @@ void ContinueWindowWin::Show(ChromotingHost* host,
return;
}
- SetStrings(host->ui_strings());
+ SetStrings();
ShowWindow(hwnd_, SW_SHOW);
}
@@ -130,24 +129,24 @@ void ContinueWindowWin::EndDialog() {
}
}
-void ContinueWindowWin::SetStrings(const UiStrings& strings) {
- SetWindowText(hwnd_, strings.product_name.c_str());
+void ContinueWindowWin::SetStrings() {
+ SetWindowText(hwnd_, ui_strings_->product_name.c_str());
HWND hwndMessage = GetDlgItem(hwnd_, IDC_CONTINUE_MESSAGE);
CHECK(hwndMessage);
- SetWindowText(hwndMessage, strings.continue_prompt.c_str());
+ SetWindowText(hwndMessage, ui_strings_->continue_prompt.c_str());
HWND hwndDefault = GetDlgItem(hwnd_, IDC_CONTINUE_DEFAULT);
CHECK(hwndDefault);
- SetWindowText(hwndDefault, strings.continue_button_text.c_str());
+ SetWindowText(hwndDefault, ui_strings_->continue_button_text.c_str());
HWND hwndCancel = GetDlgItem(hwnd_, IDC_CONTINUE_CANCEL);
CHECK(hwndCancel);
- SetWindowText(hwndCancel, strings.stop_sharing_button_text.c_str());
+ SetWindowText(hwndCancel, ui_strings_->stop_sharing_button_text.c_str());
}
-scoped_ptr<ContinueWindow> ContinueWindow::Create() {
- return scoped_ptr<ContinueWindow>(new ContinueWindowWin());
+scoped_ptr<ContinueWindow> ContinueWindow::Create(const UiStrings* ui_strings) {
+ return scoped_ptr<ContinueWindow>(new ContinueWindowWin(ui_strings));
}
} // namespace remoting

Powered by Google App Engine
This is Rietveld 408576698