| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/ui/libgtk2ui/print_dialog_gtk2.h" | 5 #include "chrome/browser/ui/libgtk2ui/print_dialog_gtk2.h" |
| 6 | 6 |
| 7 #include <gtk/gtkunixprint.h> | 7 #include <gtk/gtkunixprint.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 } | 234 } |
| 235 | 235 |
| 236 void PrintDialogGtk2::ShowDialog( | 236 void PrintDialogGtk2::ShowDialog( |
| 237 gfx::NativeView parent_view, | 237 gfx::NativeView parent_view, |
| 238 bool has_selection, | 238 bool has_selection, |
| 239 const PrintingContextLinux::PrintSettingsCallback& callback) { | 239 const PrintingContextLinux::PrintSettingsCallback& callback) { |
| 240 callback_ = callback; | 240 callback_ = callback; |
| 241 | 241 |
| 242 dialog_ = gtk_print_unix_dialog_new(NULL, NULL); | 242 dialog_ = gtk_print_unix_dialog_new(NULL, NULL); |
| 243 libgtk2ui::SetGtkTransientForAura(dialog_, parent_view); | 243 libgtk2ui::SetGtkTransientForAura(dialog_, parent_view); |
| 244 parent_view->AddObserver(this); | 244 if (parent_view) |
| 245 parent_view->AddObserver(this); |
| 245 g_signal_connect(dialog_, "delete-event", | 246 g_signal_connect(dialog_, "delete-event", |
| 246 G_CALLBACK(gtk_widget_hide_on_delete), NULL); | 247 G_CALLBACK(gtk_widget_hide_on_delete), NULL); |
| 247 | 248 |
| 248 | 249 |
| 249 // Set modal so user cannot focus the same tab and press print again. | 250 // Set modal so user cannot focus the same tab and press print again. |
| 250 gtk_window_set_modal(GTK_WINDOW(dialog_), TRUE); | 251 gtk_window_set_modal(GTK_WINDOW(dialog_), TRUE); |
| 251 | 252 |
| 252 // Since we only generate PDF, only show printers that support PDF. | 253 // Since we only generate PDF, only show printers that support PDF. |
| 253 // TODO(thestig) Add more capabilities to support? | 254 // TODO(thestig) Add more capabilities to support? |
| 254 GtkPrintCapabilities cap = static_cast<GtkPrintCapabilities>( | 255 GtkPrintCapabilities cap = static_cast<GtkPrintCapabilities>( |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 context_->InitWithSettings(*settings); | 442 context_->InitWithSettings(*settings); |
| 442 } | 443 } |
| 443 | 444 |
| 444 void PrintDialogGtk2::OnWindowDestroying(aura::Window* window) { | 445 void PrintDialogGtk2::OnWindowDestroying(aura::Window* window) { |
| 445 DCHECK_EQ(libgtk2ui::GetAuraTransientParent(dialog_), window); | 446 DCHECK_EQ(libgtk2ui::GetAuraTransientParent(dialog_), window); |
| 446 | 447 |
| 447 libgtk2ui::ClearAuraTransientParent(dialog_); | 448 libgtk2ui::ClearAuraTransientParent(dialog_); |
| 448 window->RemoveObserver(this); | 449 window->RemoveObserver(this); |
| 449 Release(); | 450 Release(); |
| 450 } | 451 } |
| OLD | NEW |