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

Unified Diff: chrome/browser/printing/print_dialog_gtk.cc

Issue 12374003: Fix crash in chrome when trying to print with CUPS down (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/printing/print_dialog_gtk.cc
diff --git a/chrome/browser/printing/print_dialog_gtk.cc b/chrome/browser/printing/print_dialog_gtk.cc
index 70fe427fff7934470a9be91725c22c4a7858dc0a..d8cb419c49f09730b1ef9c9d571e97c07fd89dc4 100644
--- a/chrome/browser/printing/print_dialog_gtk.cc
+++ b/chrome/browser/printing/print_dialog_gtk.cc
@@ -130,21 +130,11 @@ PrintDialogGtk::~PrintDialogGtk() {
void PrintDialogGtk::UseDefaultSettings() {
DCHECK(!page_setup_);
+ DCHECK(!printer_);
// |gtk_settings_| is a new object.
gtk_settings_ = gtk_print_settings_new();
-
- scoped_ptr<GtkPrinterList> printer_list(new GtkPrinterList);
- printer_ = printer_list->default_printer();
- if (printer_) {
- g_object_ref(printer_);
- gtk_print_settings_set_printer(gtk_settings_,
- gtk_printer_get_name(printer_));
- page_setup_ = gtk_printer_get_default_page_size(printer_);
- }
-
- if (!page_setup_)
- page_setup_ = gtk_page_setup_new();
+ page_setup_ = gtk_page_setup_new();
// No page range to initialize for default settings.
PageRanges ranges_vector;
@@ -173,10 +163,12 @@ bool PrintDialogGtk::UpdateSettings(const base::DictionaryValue& job_settings,
return false;
}
+ bool is_cloud_print = job_settings.HasKey(printing::kSettingCloudPrintId);
+
if (!gtk_settings_)
gtk_settings_ = gtk_print_settings_new();
- if (!print_to_pdf) {
+ if (!print_to_pdf && !is_cloud_print) {
scoped_ptr<GtkPrinterList> printer_list(new GtkPrinterList);
printer_ = printer_list->GetPrinterWithName(device_name.c_str());
if (printer_) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698