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

Side by Side Diff: chrome/browser/ui/libgtk2ui/print_dialog_gtk2.cc

Issue 328683004: Merge 270621 "Fixes the crash when the transient parent is NULL." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1985/src/
Patch Set: Created 6 years, 6 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 | « chrome/browser/ui/libgtk2ui/gtk2_util.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // TODO(mukai): take care of parent as select_file_dialog_impl_gtk2. 242 // TODO(mukai): take care of parent as select_file_dialog_impl_gtk2.
243 dialog_ = gtk_print_unix_dialog_new(NULL, NULL); 243 dialog_ = gtk_print_unix_dialog_new(NULL, NULL);
244 libgtk2ui::SetGtkTransientForAura(dialog_, parent_view); 244 libgtk2ui::SetGtkTransientForAura(dialog_, parent_view);
245 parent_view->AddObserver(this); 245 if (parent_view)
246 parent_view->AddObserver(this);
246 g_signal_connect(dialog_, "delete-event", 247 g_signal_connect(dialog_, "delete-event",
247 G_CALLBACK(gtk_widget_hide_on_delete), NULL); 248 G_CALLBACK(gtk_widget_hide_on_delete), NULL);
248 249
249 250
250 // Set modal so user cannot focus the same tab and press print again. 251 // Set modal so user cannot focus the same tab and press print again.
251 gtk_window_set_modal(GTK_WINDOW(dialog_), TRUE); 252 gtk_window_set_modal(GTK_WINDOW(dialog_), TRUE);
252 253
253 // Since we only generate PDF, only show printers that support PDF. 254 // Since we only generate PDF, only show printers that support PDF.
254 // TODO(thestig) Add more capabilities to support? 255 // TODO(thestig) Add more capabilities to support?
255 GtkPrintCapabilities cap = static_cast<GtkPrintCapabilities>( 256 GtkPrintCapabilities cap = static_cast<GtkPrintCapabilities>(
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 context_->InitWithSettings(*settings); 443 context_->InitWithSettings(*settings);
443 } 444 }
444 445
445 void PrintDialogGtk2::OnWindowDestroying(aura::Window* window) { 446 void PrintDialogGtk2::OnWindowDestroying(aura::Window* window) {
446 DCHECK_EQ(libgtk2ui::GetAuraTransientParent(dialog_), window); 447 DCHECK_EQ(libgtk2ui::GetAuraTransientParent(dialog_), window);
447 448
448 libgtk2ui::ClearAuraTransientParent(dialog_); 449 libgtk2ui::ClearAuraTransientParent(dialog_);
449 window->RemoveObserver(this); 450 window->RemoveObserver(this);
450 Release(); 451 Release();
451 } 452 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/libgtk2ui/gtk2_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698