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

Side by Side Diff: remoting/host/continue_window_linux.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/host/chromoting_host.cc ('k') | remoting/host/disconnect_window.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/host/continue_window.h" 5 #include "remoting/host/continue_window.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/utf_string_conversions.h"
11 #include "remoting/host/chromoting_host.h" 12 #include "remoting/host/chromoting_host.h"
12 #include "remoting/host/ui_strings.h" 13 #include "remoting/host/ui_strings.h"
13 #include "ui/base/gtk/gtk_signal.h" 14 #include "ui/base/gtk/gtk_signal.h"
14 15
15 namespace remoting { 16 namespace remoting {
16 17
17 class ContinueWindowLinux : public remoting::ContinueWindow { 18 class ContinueWindowLinux : public remoting::ContinueWindow {
18 public: 19 public:
19 ContinueWindowLinux(); 20 ContinueWindowLinux();
20 virtual ~ContinueWindowLinux(); 21 virtual ~ContinueWindowLinux();
21 22
22 virtual void Show(remoting::ChromotingHost* host) OVERRIDE; 23 virtual void Show(remoting::ChromotingHost* host) OVERRIDE;
23 virtual void Hide() OVERRIDE; 24 virtual void Hide() OVERRIDE;
24 25
25 private: 26 private:
26 CHROMEGTK_CALLBACK_1(ContinueWindowLinux, void, OnResponse, int); 27 CHROMEGTK_CALLBACK_1(ContinueWindowLinux, void, OnResponse, int);
27 28
28 void CreateWindow(UiStrings* ui_strings); 29 void CreateWindow(const UiStrings& ui_strings);
29 30
30 ChromotingHost* host_; 31 ChromotingHost* host_;
31 GtkWidget* continue_window_; 32 GtkWidget* continue_window_;
32 33
33 DISALLOW_COPY_AND_ASSIGN(ContinueWindowLinux); 34 DISALLOW_COPY_AND_ASSIGN(ContinueWindowLinux);
34 }; 35 };
35 36
36 ContinueWindowLinux::ContinueWindowLinux() 37 ContinueWindowLinux::ContinueWindowLinux()
37 : host_(NULL), 38 : host_(NULL),
38 continue_window_(NULL) { 39 continue_window_(NULL) {
39 } 40 }
40 41
41 ContinueWindowLinux::~ContinueWindowLinux() { 42 ContinueWindowLinux::~ContinueWindowLinux() {
42 } 43 }
43 44
44 void ContinueWindowLinux::CreateWindow(UiStrings* ui_strings) { 45 void ContinueWindowLinux::CreateWindow(const UiStrings& ui_strings) {
45 if (continue_window_) return; 46 if (continue_window_) return;
46 47
47 continue_window_ = gtk_dialog_new_with_buttons( 48 continue_window_ = gtk_dialog_new_with_buttons(
48 ui_strings->product_name.c_str(), 49 UTF16ToUTF8(ui_strings.product_name).c_str(),
49 NULL, 50 NULL,
50 static_cast<GtkDialogFlags>(GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR), 51 static_cast<GtkDialogFlags>(GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR),
51 ui_strings->stop_sharing_button_text.c_str(), GTK_RESPONSE_CANCEL, 52 UTF16ToUTF8(ui_strings.stop_sharing_button_text).c_str(),
52 ui_strings->continue_button_text.c_str(), GTK_RESPONSE_OK, 53 GTK_RESPONSE_CANCEL,
54 UTF16ToUTF8(ui_strings.continue_button_text).c_str(),
55 GTK_RESPONSE_OK,
53 NULL); 56 NULL);
54 57
55 gtk_dialog_set_default_response(GTK_DIALOG(continue_window_), 58 gtk_dialog_set_default_response(GTK_DIALOG(continue_window_),
56 GTK_RESPONSE_OK); 59 GTK_RESPONSE_OK);
57 gtk_window_set_resizable(GTK_WINDOW(continue_window_), FALSE); 60 gtk_window_set_resizable(GTK_WINDOW(continue_window_), FALSE);
58 61
59 // Set always-on-top, otherwise this window tends to be obscured by the 62 // Set always-on-top, otherwise this window tends to be obscured by the
60 // DisconnectWindow. 63 // DisconnectWindow.
61 gtk_window_set_keep_above(GTK_WINDOW(continue_window_), TRUE); 64 gtk_window_set_keep_above(GTK_WINDOW(continue_window_), TRUE);
62 65
63 g_signal_connect(continue_window_, "response", 66 g_signal_connect(continue_window_, "response",
64 G_CALLBACK(OnResponseThunk), this); 67 G_CALLBACK(OnResponseThunk), this);
65 68
66 GtkWidget* content_area = 69 GtkWidget* content_area =
67 gtk_dialog_get_content_area(GTK_DIALOG(continue_window_)); 70 gtk_dialog_get_content_area(GTK_DIALOG(continue_window_));
68 71
69 GtkWidget* text_label = gtk_label_new(ui_strings->continue_prompt.c_str()); 72 GtkWidget* text_label =
73 gtk_label_new(UTF16ToUTF8(ui_strings.continue_prompt).c_str());
70 gtk_label_set_line_wrap(GTK_LABEL(text_label), TRUE); 74 gtk_label_set_line_wrap(GTK_LABEL(text_label), TRUE);
71 // TODO(lambroslambrou): Fix magic numbers, as in disconnect_window_linux.cc. 75 // TODO(lambroslambrou): Fix magic numbers, as in disconnect_window_linux.cc.
72 gtk_misc_set_padding(GTK_MISC(text_label), 12, 12); 76 gtk_misc_set_padding(GTK_MISC(text_label), 12, 12);
73 gtk_container_add(GTK_CONTAINER(content_area), text_label); 77 gtk_container_add(GTK_CONTAINER(content_area), text_label);
74 78
75 gtk_widget_show_all(content_area); 79 gtk_widget_show_all(content_area);
76 } 80 }
77 81
78 void ContinueWindowLinux::Show(remoting::ChromotingHost* host) { 82 void ContinueWindowLinux::Show(remoting::ChromotingHost* host) {
79 host_ = host; 83 host_ = host;
(...skipping 16 matching lines...) Expand all
96 host_->Shutdown(NULL); 100 host_->Shutdown(NULL);
97 } 101 }
98 Hide(); 102 Hide();
99 } 103 }
100 104
101 ContinueWindow* ContinueWindow::Create() { 105 ContinueWindow* ContinueWindow::Create() {
102 return new ContinueWindowLinux(); 106 return new ContinueWindowLinux();
103 } 107 }
104 108
105 } // namespace remoting 109 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/chromoting_host.cc ('k') | remoting/host/disconnect_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698