OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/cups_helper.h" | 5 #include "printing/backend/cups_helper.h" |
6 | 6 |
7 #include <cups/ppd.h> | 7 #include <cups/ppd.h> |
8 | 8 |
9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 } | 358 } |
359 | 359 |
360 ppd_file_t* ppd = ppdOpenFile(ppd_file_path.value().c_str()); | 360 ppd_file_t* ppd = ppdOpenFile(ppd_file_path.value().c_str()); |
361 if (!ppd) | 361 if (!ppd) |
362 return false; | 362 return false; |
363 | 363 |
364 printing::PrinterSemanticCapsAndDefaults caps; | 364 printing::PrinterSemanticCapsAndDefaults caps; |
365 #if !defined(OS_MACOSX) | 365 #if !defined(OS_MACOSX) |
366 MarkLpOptions(printer_name, &ppd); | 366 MarkLpOptions(printer_name, &ppd); |
367 #endif | 367 #endif |
| 368 caps.collate_capable = true; |
| 369 caps.collate_default = true; |
| 370 caps.copies_capable = true; |
| 371 |
368 ppd_choice_t* duplex_choice = ppdFindMarkedChoice(ppd, kDuplex); | 372 ppd_choice_t* duplex_choice = ppdFindMarkedChoice(ppd, kDuplex); |
369 if (!duplex_choice) { | 373 if (!duplex_choice) { |
370 ppd_option_t* option = ppdFindOption(ppd, kDuplex); | 374 ppd_option_t* option = ppdFindOption(ppd, kDuplex); |
371 if (option) | 375 if (option) |
372 duplex_choice = ppdFindChoice(option, option->defchoice); | 376 duplex_choice = ppdFindChoice(option, option->defchoice); |
373 } | 377 } |
374 | 378 |
375 if (duplex_choice) { | 379 if (duplex_choice) { |
376 caps.duplex_capable = true; | 380 caps.duplex_capable = true; |
377 if (base::strcasecmp(duplex_choice->choice, kDuplexNone) != 0) | 381 if (base::strcasecmp(duplex_choice->choice, kDuplexNone) != 0) |
(...skipping 16 matching lines...) Expand all Loading... |
394 caps.bw_model = cm_black; | 398 caps.bw_model = cm_black; |
395 | 399 |
396 ppdClose(ppd); | 400 ppdClose(ppd); |
397 base::DeleteFile(ppd_file_path, false); | 401 base::DeleteFile(ppd_file_path, false); |
398 | 402 |
399 *printer_info = caps; | 403 *printer_info = caps; |
400 return true; | 404 return true; |
401 } | 405 } |
402 | 406 |
403 } // namespace printing | 407 } // namespace printing |
OLD | NEW |