| 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 17 matching lines...) Expand all Loading... |
| 28 const char kHighGray[] = "High.Gray"; | 28 const char kHighGray[] = "High.Gray"; |
| 29 | 29 |
| 30 const char kDuplex[] = "Duplex"; | 30 const char kDuplex[] = "Duplex"; |
| 31 const char kDuplexNone[] = "None"; | 31 const char kDuplexNone[] = "None"; |
| 32 | 32 |
| 33 #if !defined(OS_MACOSX) | 33 #if !defined(OS_MACOSX) |
| 34 void ParseLpOptions(const base::FilePath& filepath, | 34 void ParseLpOptions(const base::FilePath& filepath, |
| 35 const std::string& printer_name, | 35 const std::string& printer_name, |
| 36 int* num_options, cups_option_t** options) { | 36 int* num_options, cups_option_t** options) { |
| 37 std::string content; | 37 std::string content; |
| 38 if (!file_util::ReadFileToString(filepath, &content)) | 38 if (!base::ReadFileToString(filepath, &content)) |
| 39 return; | 39 return; |
| 40 | 40 |
| 41 const char kDest[] = "dest"; | 41 const char kDest[] = "dest"; |
| 42 const char kDefault[] = "default"; | 42 const char kDefault[] = "default"; |
| 43 const size_t kDestLen = sizeof(kDest) - 1; | 43 const size_t kDestLen = sizeof(kDest) - 1; |
| 44 const size_t kDefaultLen = sizeof(kDefault) - 1; | 44 const size_t kDefaultLen = sizeof(kDefault) - 1; |
| 45 std::vector<std::string> lines; | 45 std::vector<std::string> lines; |
| 46 base::SplitString(content, '\n', &lines); | 46 base::SplitString(content, '\n', &lines); |
| 47 | 47 |
| 48 for (size_t i = 0; i < lines.size(); ++i) { | 48 for (size_t i = 0; i < lines.size(); ++i) { |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 caps.color_default = is_color; | 387 caps.color_default = is_color; |
| 388 | 388 |
| 389 ppdClose(ppd); | 389 ppdClose(ppd); |
| 390 base::DeleteFile(ppd_file_path, false); | 390 base::DeleteFile(ppd_file_path, false); |
| 391 | 391 |
| 392 *printer_info = caps; | 392 *printer_info = caps; |
| 393 return true; | 393 return true; |
| 394 } | 394 } |
| 395 | 395 |
| 396 } // namespace printing | 396 } // namespace printing |
| OLD | NEW |