| 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/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 | 338 |
| 339 bool ParsePpdCapabilities( | 339 bool ParsePpdCapabilities( |
| 340 const std::string& printer_name, | 340 const std::string& printer_name, |
| 341 const std::string& printer_capabilities, | 341 const std::string& printer_capabilities, |
| 342 PrinterSemanticCapsAndDefaults* printer_info) { | 342 PrinterSemanticCapsAndDefaults* printer_info) { |
| 343 base::FilePath ppd_file_path; | 343 base::FilePath ppd_file_path; |
| 344 if (!base::CreateTemporaryFile(&ppd_file_path)) | 344 if (!base::CreateTemporaryFile(&ppd_file_path)) |
| 345 return false; | 345 return false; |
| 346 | 346 |
| 347 int data_size = printer_capabilities.length(); | 347 int data_size = printer_capabilities.length(); |
| 348 if (data_size != file_util::WriteFile( | 348 if (data_size != base::WriteFile( |
| 349 ppd_file_path, | 349 ppd_file_path, |
| 350 printer_capabilities.data(), | 350 printer_capabilities.data(), |
| 351 data_size)) { | 351 data_size)) { |
| 352 base::DeleteFile(ppd_file_path, false); | 352 base::DeleteFile(ppd_file_path, false); |
| 353 return false; | 353 return false; |
| 354 } | 354 } |
| 355 | 355 |
| 356 ppd_file_t* ppd = ppdOpenFile(ppd_file_path.value().c_str()); | 356 ppd_file_t* ppd = ppdOpenFile(ppd_file_path.value().c_str()); |
| 357 if (!ppd) | 357 if (!ppd) |
| 358 return false; | 358 return false; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 caps.bw_model = cm_black; | 390 caps.bw_model = cm_black; |
| 391 | 391 |
| 392 ppdClose(ppd); | 392 ppdClose(ppd); |
| 393 base::DeleteFile(ppd_file_path, false); | 393 base::DeleteFile(ppd_file_path, false); |
| 394 | 394 |
| 395 *printer_info = caps; | 395 *printer_info = caps; |
| 396 return true; | 396 return true; |
| 397 } | 397 } |
| 398 | 398 |
| 399 } // namespace printing | 399 } // namespace printing |
| OLD | NEW |