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

Side by Side 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: Cleaning up, adding comments 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "printing/backend/print_backend.h" 5 #include "printing/backend/print_backend.h"
6 6
7 #include <dlfcn.h> 7 #include <dlfcn.h>
8 #include <errno.h> 8 #include <errno.h>
9 #if !defined(OS_MACOSX) 9 #if !defined(OS_MACOSX)
10 #include <gcrypt.h> 10 #include <gcrypt.h>
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 printer_list->push_back(printer_info); 149 printer_list->push_back(printer_info);
150 } 150 }
151 151
152 cupsFreeDests(num_dests, destinations); 152 cupsFreeDests(num_dests, destinations);
153 153
154 VLOG(1) << "CUPS: Enumerated " << printer_list->size() << " printers."; 154 VLOG(1) << "CUPS: Enumerated " << printer_list->size() << " printers.";
155 return true; 155 return true;
156 } 156 }
157 157
158 std::string PrintBackendCUPS::GetDefaultPrinterName() { 158 std::string PrintBackendCUPS::GetDefaultPrinterName() {
159 // TODO(thestig) Figure out why cupsGetDefault() lies about the default 159 cups_dest_t *dests;
160 // printer. :-( 160 int num_dests = cupsGetDests(&dests);
161 // Return an empty string for now. 161 cups_dest_t* dest = cupsGetDest(NULL, NULL, num_dests, dests);
162 return std::string(); 162 return std::string(dest->name);
163 } 163 }
164 164
165 bool PrintBackendCUPS::GetPrinterCapsAndDefaults( 165 bool PrintBackendCUPS::GetPrinterCapsAndDefaults(
166 const std::string& printer_name, 166 const std::string& printer_name,
167 PrinterCapsAndDefaults* printer_info) { 167 PrinterCapsAndDefaults* printer_info) {
168 DCHECK(printer_info); 168 DCHECK(printer_info);
169 169
170 VLOG(1) << "CUPS: Getting Caps and Defaults for: " << printer_name; 170 VLOG(1) << "CUPS: Getting Caps and Defaults for: " << printer_name;
171 171
172 FilePath ppd_path(GetPPD(printer_name.c_str())); 172 FilePath ppd_path(GetPPD(printer_name.c_str()));
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 << ", HTTP error: " << http_error; 277 << ", HTTP error: " << http_error;
278 file_util::Delete(ppd_path, false); 278 file_util::Delete(ppd_path, false);
279 ppd_path.clear(); 279 ppd_path.clear();
280 } 280 }
281 } 281 }
282 } 282 }
283 return ppd_path; 283 return ppd_path;
284 } 284 }
285 285
286 } // namespace printing 286 } // namespace printing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698