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

Unified Diff: printing/backend/print_backend_cups.cc

Issue 7042034: Print Preview: Remembering last used printer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/print_preview_handler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: printing/backend/print_backend_cups.cc
diff --git a/printing/backend/print_backend_cups.cc b/printing/backend/print_backend_cups.cc
index 9b6976c0700c5df0b16a359332631368001ee9b0..8578a7c1dc571271a2b45e6ccccb085e08fe88a5 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(
« no previous file with comments | « chrome/browser/ui/webui/print_preview_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698