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

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: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/webui/print_preview_handler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Not using cupsGetDefault() because it lies about the default printer.
160 // printer. :-( 160 cups_dest_t* dests;
161 // Return an empty string for now. 161 int num_dests = GetDests(&dests);
162 return std::string(); 162 cups_dest_t* dest = cupsGetDest(NULL, NULL, num_dests, dests);
163 return dest ? std::string(dest->name) : std::string();
163 } 164 }
164 165
165 bool PrintBackendCUPS::GetPrinterCapsAndDefaults( 166 bool PrintBackendCUPS::GetPrinterCapsAndDefaults(
166 const std::string& printer_name, 167 const std::string& printer_name,
167 PrinterCapsAndDefaults* printer_info) { 168 PrinterCapsAndDefaults* printer_info) {
168 DCHECK(printer_info); 169 DCHECK(printer_info);
169 170
170 VLOG(1) << "CUPS: Getting Caps and Defaults for: " << printer_name; 171 VLOG(1) << "CUPS: Getting Caps and Defaults for: " << printer_name;
171 172
172 FilePath ppd_path(GetPPD(printer_name.c_str())); 173 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; 278 << ", HTTP error: " << http_error;
278 file_util::Delete(ppd_path, false); 279 file_util::Delete(ppd_path, false);
279 ppd_path.clear(); 280 ppd_path.clear();
280 } 281 }
281 } 282 }
282 } 283 }
283 return ppd_path; 284 return ppd_path;
284 } 285 }
285 286
286 } // namespace printing 287 } // namespace printing
OLDNEW
« 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