diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-20 02:04:19 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-20 02:04:19 +0000 |
commit | 40ded3df5caebd375b0431d3165e1c11768ec767 (patch) | |
tree | dbbd6cd149e3e0e8d2d9d6800b3aea6558f65d16 | |
parent | dc55625cce6709a969635777c8df19c1e9b055a2 (diff) | |
download | chromium_src-40ded3df5caebd375b0431d3165e1c11768ec767.zip chromium_src-40ded3df5caebd375b0431d3165e1c11768ec767.tar.gz chromium_src-40ded3df5caebd375b0431d3165e1c11768ec767.tar.bz2 |
Linux Printing: Continue trying to update settings even if we cannot find the printer.
BUG=79945
TEST=See bug.
Review URL: http://codereview.chromium.org/6878064
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82217 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/printing/print_dialog_gtk.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/chrome/browser/printing/print_dialog_gtk.cc b/chrome/browser/printing/print_dialog_gtk.cc index 72a7c4c..0329478 100644 --- a/chrome/browser/printing/print_dialog_gtk.cc +++ b/chrome/browser/printing/print_dialog_gtk.cc @@ -43,10 +43,15 @@ class GtkPrinterList { } } + // Can return NULL if there's no default printer. E.g. Printer on a laptop + // is "home_printer", but the laptop is at work. GtkPrinter* default_printer() { return default_printer_; } + // Can return NULL if the printer cannot be found due to: + // - Printer list out of sync with printer dialog UI. + // - Querying for non-existant printers like 'Print to PDF'. GtkPrinter* GetPrinterWithName(const char* name) { if (!name || !*name) return NULL; @@ -149,11 +154,11 @@ bool PrintDialogGtk::UpdateSettings(const DictionaryValue& settings, scoped_ptr<GtkPrinterList> printer_list(new GtkPrinterList); printer_ = printer_list->GetPrinterWithName(printer_name.c_str()); - if (!printer_) - return false; - g_object_ref(printer_); - gtk_print_settings_set_printer(gtk_settings_, - gtk_printer_get_name(printer_)); + if (printer_) { + g_object_ref(printer_); + gtk_print_settings_set_printer(gtk_settings_, + gtk_printer_get_name(printer_)); + } bool landscape; if (!settings.GetBoolean(printing::kSettingLandscape, &landscape)) |