| 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/print_backend.h" | 5 #include "printing/backend/print_backend.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #include <dlfcn.h> | 9 #include <dlfcn.h> |
| 10 #include <errno.h> | 10 #include <errno.h> |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 | 244 |
| 245 base::FilePath ppd_path(GetPPD(printer_name.c_str())); | 245 base::FilePath ppd_path(GetPPD(printer_name.c_str())); |
| 246 // In some cases CUPS failed to get ppd file. | 246 // In some cases CUPS failed to get ppd file. |
| 247 if (ppd_path.empty()) { | 247 if (ppd_path.empty()) { |
| 248 LOG(ERROR) << "CUPS: Failed to get PPD" | 248 LOG(ERROR) << "CUPS: Failed to get PPD" |
| 249 << ", printer name: " << printer_name; | 249 << ", printer name: " << printer_name; |
| 250 return false; | 250 return false; |
| 251 } | 251 } |
| 252 | 252 |
| 253 std::string content; | 253 std::string content; |
| 254 bool res = file_util::ReadFileToString(ppd_path, &content); | 254 bool res = base::ReadFileToString(ppd_path, &content); |
| 255 | 255 |
| 256 base::DeleteFile(ppd_path, false); | 256 base::DeleteFile(ppd_path, false); |
| 257 | 257 |
| 258 if (res) { | 258 if (res) { |
| 259 printer_info->printer_capabilities.swap(content); | 259 printer_info->printer_capabilities.swap(content); |
| 260 printer_info->caps_mime_type = "application/pagemaker"; | 260 printer_info->caps_mime_type = "application/pagemaker"; |
| 261 // In CUPS, printer defaults is a part of PPD file. Nothing to upload here. | 261 // In CUPS, printer defaults is a part of PPD file. Nothing to upload here. |
| 262 printer_info->printer_defaults.clear(); | 262 printer_info->printer_defaults.clear(); |
| 263 printer_info->defaults_mime_type.clear(); | 263 printer_info->defaults_mime_type.clear(); |
| 264 } | 264 } |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 << ", HTTP error: " << http_error; | 377 << ", HTTP error: " << http_error; |
| 378 base::DeleteFile(ppd_path, false); | 378 base::DeleteFile(ppd_path, false); |
| 379 ppd_path.clear(); | 379 ppd_path.clear(); |
| 380 } | 380 } |
| 381 } | 381 } |
| 382 } | 382 } |
| 383 return ppd_path; | 383 return ppd_path; |
| 384 } | 384 } |
| 385 | 385 |
| 386 } // namespace printing | 386 } // namespace printing |
| OLD | NEW |