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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 int PrintBackendCUPS::GetDests(cups_dest_t** dests) { | 320 int PrintBackendCUPS::GetDests(cups_dest_t** dests) { |
321 if (print_server_url_.is_empty()) { // Use default (local) print server. | 321 if (print_server_url_.is_empty()) { // Use default (local) print server. |
322 return cupsGetDests(dests); | 322 return cupsGetDests(dests); |
323 } else { | 323 } else { |
324 HttpConnectionCUPS http(print_server_url_, cups_encryption_); | 324 HttpConnectionCUPS http(print_server_url_, cups_encryption_); |
325 http.SetBlocking(blocking_); | 325 http.SetBlocking(blocking_); |
326 return cupsGetDests2(http.http(), dests); | 326 return cupsGetDests2(http.http(), dests); |
327 } | 327 } |
328 } | 328 } |
329 | 329 |
330 FilePath PrintBackendCUPS::GetPPD(const char* name) { | 330 base::FilePath PrintBackendCUPS::GetPPD(const char* name) { |
331 // cupsGetPPD returns a filename stored in a static buffer in CUPS. | 331 // cupsGetPPD returns a filename stored in a static buffer in CUPS. |
332 // Protect this code with lock. | 332 // Protect this code with lock. |
333 CR_DEFINE_STATIC_LOCAL(base::Lock, ppd_lock, ()); | 333 CR_DEFINE_STATIC_LOCAL(base::Lock, ppd_lock, ()); |
334 base::AutoLock ppd_autolock(ppd_lock); | 334 base::AutoLock ppd_autolock(ppd_lock); |
335 base::FilePath ppd_path; | 335 base::FilePath ppd_path; |
336 const char* ppd_file_path = NULL; | 336 const char* ppd_file_path = NULL; |
337 if (print_server_url_.is_empty()) { // Use default (local) print server. | 337 if (print_server_url_.is_empty()) { // Use default (local) print server. |
338 ppd_file_path = cupsGetPPD(name); | 338 ppd_file_path = cupsGetPPD(name); |
339 if (ppd_file_path) | 339 if (ppd_file_path) |
340 ppd_path = base::FilePath(ppd_file_path); | 340 ppd_path = base::FilePath(ppd_file_path); |
(...skipping 29 matching lines...) Expand all Loading... |
370 << ", HTTP error: " << http_error; | 370 << ", HTTP error: " << http_error; |
371 file_util::Delete(ppd_path, false); | 371 file_util::Delete(ppd_path, false); |
372 ppd_path.clear(); | 372 ppd_path.clear(); |
373 } | 373 } |
374 } | 374 } |
375 } | 375 } |
376 return ppd_path; | 376 return ppd_path; |
377 } | 377 } |
378 | 378 |
379 } // namespace printing | 379 } // namespace printing |
OLD | NEW |