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

Side by Side Diff: remoting/host/continue_window_linux.cc

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

Powered by Google App Engine
This is Rietveld 408576698