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

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
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 "remoting/host/chromoting_host.h" 11 #include "remoting/host/chromoting_host.h"
12 #include "remoting/host/ui_strings.h" 12 #include "remoting/host/ui_strings.h"
13 #include "ui/base/gtk/gtk_signal.h" 13 #include "ui/base/gtk/gtk_signal.h"
14 14
15 namespace remoting { 15 namespace remoting {
16 16
17 class ContinueWindowLinux : public remoting::ContinueWindow { 17 class ContinueWindowLinux : public remoting::ContinueWindow {
18 public: 18 public:
19 ContinueWindowLinux(); 19 ContinueWindowLinux();
20 virtual ~ContinueWindowLinux(); 20 virtual ~ContinueWindowLinux();
21 21
22 virtual void Show(remoting::ChromotingHost* host) OVERRIDE; 22 virtual void Show(remoting::ChromotingHost* host) OVERRIDE;
23 virtual void Hide() OVERRIDE; 23 virtual void Hide() OVERRIDE;
24 24
25 private: 25 private:
26 CHROMEGTK_CALLBACK_1(ContinueWindowLinux, void, OnResponse, int); 26 CHROMEGTK_CALLBACK_1(ContinueWindowLinux, void, OnResponse, int);
27 27
28 void CreateWindow(UiStrings* ui_strings); 28 void CreateWindow(const UiStrings& ui_strings);
29 29
30 ChromotingHost* host_; 30 ChromotingHost* host_;
31 GtkWidget* continue_window_; 31 GtkWidget* continue_window_;
32 32
33 DISALLOW_COPY_AND_ASSIGN(ContinueWindowLinux); 33 DISALLOW_COPY_AND_ASSIGN(ContinueWindowLinux);
34 }; 34 };
35 35
36 ContinueWindowLinux::ContinueWindowLinux() 36 ContinueWindowLinux::ContinueWindowLinux()
37 : host_(NULL), 37 : host_(NULL),
38 continue_window_(NULL) { 38 continue_window_(NULL) {
39 } 39 }
40 40
41 ContinueWindowLinux::~ContinueWindowLinux() { 41 ContinueWindowLinux::~ContinueWindowLinux() {
42 } 42 }
43 43
44 void ContinueWindowLinux::CreateWindow(UiStrings* ui_strings) { 44 void ContinueWindowLinux::CreateWindow(const UiStrings& ui_strings) {
45 if (continue_window_) return; 45 if (continue_window_) return;
46 46
47 continue_window_ = gtk_dialog_new_with_buttons( 47 continue_window_ = gtk_dialog_new_with_buttons(
48 ui_strings->product_name.c_str(), 48 ui_strings.product_name.c_str(),
49 NULL, 49 NULL,
50 static_cast<GtkDialogFlags>(GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR), 50 static_cast<GtkDialogFlags>(GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR),
51 ui_strings->stop_sharing_button_text.c_str(), GTK_RESPONSE_CANCEL, 51 ui_strings.stop_sharing_button_text.c_str(), GTK_RESPONSE_CANCEL,
52 ui_strings->continue_button_text.c_str(), GTK_RESPONSE_OK, 52 ui_strings.continue_button_text.c_str(), GTK_RESPONSE_OK,
53 NULL); 53 NULL);
54 54
55 gtk_dialog_set_default_response(GTK_DIALOG(continue_window_), 55 gtk_dialog_set_default_response(GTK_DIALOG(continue_window_),
56 GTK_RESPONSE_OK); 56 GTK_RESPONSE_OK);
57 gtk_window_set_resizable(GTK_WINDOW(continue_window_), FALSE); 57 gtk_window_set_resizable(GTK_WINDOW(continue_window_), FALSE);
58 58
59 // Set always-on-top, otherwise this window tends to be obscured by the 59 // Set always-on-top, otherwise this window tends to be obscured by the
60 // DisconnectWindow. 60 // DisconnectWindow.
61 gtk_window_set_keep_above(GTK_WINDOW(continue_window_), TRUE); 61 gtk_window_set_keep_above(GTK_WINDOW(continue_window_), TRUE);
62 62
63 g_signal_connect(continue_window_, "response", 63 g_signal_connect(continue_window_, "response",
64 G_CALLBACK(OnResponseThunk), this); 64 G_CALLBACK(OnResponseThunk), this);
65 65
66 GtkWidget* content_area = 66 GtkWidget* content_area =
67 gtk_dialog_get_content_area(GTK_DIALOG(continue_window_)); 67 gtk_dialog_get_content_area(GTK_DIALOG(continue_window_));
68 68
69 GtkWidget* text_label = gtk_label_new(ui_strings->continue_prompt.c_str()); 69 GtkWidget* text_label = gtk_label_new(ui_strings.continue_prompt.c_str());
70 gtk_label_set_line_wrap(GTK_LABEL(text_label), TRUE); 70 gtk_label_set_line_wrap(GTK_LABEL(text_label), TRUE);
71 // TODO(lambroslambrou): Fix magic numbers, as in disconnect_window_linux.cc. 71 // TODO(lambroslambrou): Fix magic numbers, as in disconnect_window_linux.cc.
72 gtk_misc_set_padding(GTK_MISC(text_label), 12, 12); 72 gtk_misc_set_padding(GTK_MISC(text_label), 12, 12);
73 gtk_container_add(GTK_CONTAINER(content_area), text_label); 73 gtk_container_add(GTK_CONTAINER(content_area), text_label);
74 74
75 gtk_widget_show_all(content_area); 75 gtk_widget_show_all(content_area);
76 } 76 }
77 77
78 void ContinueWindowLinux::Show(remoting::ChromotingHost* host) { 78 void ContinueWindowLinux::Show(remoting::ChromotingHost* host) {
79 host_ = host; 79 host_ = host;
(...skipping 16 matching lines...) Expand all
96 host_->Shutdown(NULL); 96 host_->Shutdown(NULL);
97 } 97 }
98 Hide(); 98 Hide();
99 } 99 }
100 100
101 ContinueWindow* ContinueWindow::Create() { 101 ContinueWindow* ContinueWindow::Create() {
102 return new ContinueWindowLinux(); 102 return new ContinueWindowLinux();
103 } 103 }
104 104
105 } // namespace remoting 105 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698