| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 } | 42 } |
| 43 | 43 |
| 44 ContinueWindowGtk::~ContinueWindowGtk() { | 44 ContinueWindowGtk::~ContinueWindowGtk() { |
| 45 if (continue_window_) { | 45 if (continue_window_) { |
| 46 gtk_widget_destroy(continue_window_); | 46 gtk_widget_destroy(continue_window_); |
| 47 continue_window_ = nullptr; | 47 continue_window_ = nullptr; |
| 48 } | 48 } |
| 49 } | 49 } |
| 50 | 50 |
| 51 void ContinueWindowGtk::ShowUi() { | 51 void ContinueWindowGtk::ShowUi() { |
| 52 DCHECK(CalledOnValidThread()); | 52 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 53 DCHECK(!continue_window_); | 53 DCHECK(!continue_window_); |
| 54 | 54 |
| 55 CreateWindow(); | 55 CreateWindow(); |
| 56 gtk_window_set_urgency_hint(GTK_WINDOW(continue_window_), TRUE); | 56 gtk_window_set_urgency_hint(GTK_WINDOW(continue_window_), TRUE); |
| 57 gtk_window_present(GTK_WINDOW(continue_window_)); | 57 gtk_window_present(GTK_WINDOW(continue_window_)); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void ContinueWindowGtk::HideUi() { | 60 void ContinueWindowGtk::HideUi() { |
| 61 DCHECK(CalledOnValidThread()); | 61 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 62 | 62 |
| 63 if (continue_window_) { | 63 if (continue_window_) { |
| 64 gtk_widget_destroy(continue_window_); | 64 gtk_widget_destroy(continue_window_); |
| 65 continue_window_ = nullptr; | 65 continue_window_ = nullptr; |
| 66 } | 66 } |
| 67 } | 67 } |
| 68 | 68 |
| 69 void ContinueWindowGtk::CreateWindow() { | 69 void ContinueWindowGtk::CreateWindow() { |
| 70 DCHECK(CalledOnValidThread()); | 70 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 71 DCHECK(!continue_window_); | 71 DCHECK(!continue_window_); |
| 72 | 72 |
| 73 GtkDialogFlags flags = GTK_DIALOG_MODAL; | 73 GtkDialogFlags flags = GTK_DIALOG_MODAL; |
| 74 #if GTK_MAJOR_VERSION == 2 | 74 #if GTK_MAJOR_VERSION == 2 |
| 75 flags = static_cast<GtkDialogFlags>(flags | GTK_DIALOG_NO_SEPARATOR); | 75 flags = static_cast<GtkDialogFlags>(flags | GTK_DIALOG_NO_SEPARATOR); |
| 76 #endif | 76 #endif |
| 77 continue_window_ = gtk_dialog_new_with_buttons( | 77 continue_window_ = gtk_dialog_new_with_buttons( |
| 78 l10n_util::GetStringUTF8(IDS_PRODUCT_NAME).c_str(), | 78 l10n_util::GetStringUTF8(IDS_PRODUCT_NAME).c_str(), |
| 79 nullptr, | 79 nullptr, |
| 80 flags, | 80 flags, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 104 // TODO(lambroslambrou): Fix magic numbers, as in disconnect_window_gtk.cc. | 104 // TODO(lambroslambrou): Fix magic numbers, as in disconnect_window_gtk.cc. |
| 105 G_GNUC_BEGIN_IGNORE_DEPRECATIONS; | 105 G_GNUC_BEGIN_IGNORE_DEPRECATIONS; |
| 106 gtk_misc_set_padding(GTK_MISC(text_label), 12, 12); | 106 gtk_misc_set_padding(GTK_MISC(text_label), 12, 12); |
| 107 G_GNUC_END_IGNORE_DEPRECATIONS; | 107 G_GNUC_END_IGNORE_DEPRECATIONS; |
| 108 gtk_container_add(GTK_CONTAINER(content_area), text_label); | 108 gtk_container_add(GTK_CONTAINER(content_area), text_label); |
| 109 | 109 |
| 110 gtk_widget_show_all(content_area); | 110 gtk_widget_show_all(content_area); |
| 111 } | 111 } |
| 112 | 112 |
| 113 void ContinueWindowGtk::OnResponse(GtkDialog* dialog, int response_id) { | 113 void ContinueWindowGtk::OnResponse(GtkDialog* dialog, int response_id) { |
| 114 DCHECK(CalledOnValidThread()); | 114 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 115 | 115 |
| 116 if (response_id == GTK_RESPONSE_OK) { | 116 if (response_id == GTK_RESPONSE_OK) { |
| 117 ContinueSession(); | 117 ContinueSession(); |
| 118 } else { | 118 } else { |
| 119 DisconnectSession(); | 119 DisconnectSession(); |
| 120 } | 120 } |
| 121 | 121 |
| 122 HideUi(); | 122 HideUi(); |
| 123 } | 123 } |
| 124 | 124 |
| 125 // static | 125 // static |
| 126 std::unique_ptr<HostWindow> HostWindow::CreateContinueWindow() { | 126 std::unique_ptr<HostWindow> HostWindow::CreateContinueWindow() { |
| 127 return base::MakeUnique<ContinueWindowGtk>(); | 127 return base::MakeUnique<ContinueWindowGtk>(); |
| 128 } | 128 } |
| 129 | 129 |
| 130 } // namespace remoting | 130 } // namespace remoting |
| OLD | NEW |