summaryrefslogtreecommitdiffstats
path: root/printing/backend
diff options
context:
space:
mode:
authordpapad@chromium.org <dpapad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-08 21:06:41 +0000
committerdpapad@chromium.org <dpapad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-08 21:06:41 +0000
commitaa27b95336f42a96f5af6fc56469af23f005bfea (patch)
treeec2773e09ca50f04bb337a35ae7782432812eef8 /printing/backend
parent1a0cc6db8c687e04e16adaa40c7414bbd630fe4e (diff)
downloadchromium_src-aa27b95336f42a96f5af6fc56469af23f005bfea.zip
chromium_src-aa27b95336f42a96f5af6fc56469af23f005bfea.tar.gz
chromium_src-aa27b95336f42a96f5af6fc56469af23f005bfea.tar.bz2
Print Preview: Remembering last used printer.
BUG=85081 TEST=Open print preview tab, print a doc. Reopen, the last used printer should be pre-selected. Review URL: http://codereview.chromium.org/7042034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@88399 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing/backend')
-rw-r--r--printing/backend/print_backend_cups.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/printing/backend/print_backend_cups.cc b/printing/backend/print_backend_cups.cc
index 9b6976c..8578a7c 100644
--- a/printing/backend/print_backend_cups.cc
+++ b/printing/backend/print_backend_cups.cc
@@ -156,10 +156,11 @@ bool PrintBackendCUPS::EnumeratePrinters(PrinterList* printer_list) {
}
std::string PrintBackendCUPS::GetDefaultPrinterName() {
- // TODO(thestig) Figure out why cupsGetDefault() lies about the default
- // printer. :-(
- // Return an empty string for now.
- return std::string();
+ // Not using cupsGetDefault() because it lies about the default printer.
+ cups_dest_t* dests;
+ int num_dests = GetDests(&dests);
+ cups_dest_t* dest = cupsGetDest(NULL, NULL, num_dests, dests);
+ return dest ? std::string(dest->name) : std::string();
}
bool PrintBackendCUPS::GetPrinterCapsAndDefaults(