Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1058)

Side by Side Diff: printing/backend/print_backend_cups.cc

Issue 16950028: Move file_util::Delete to the base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « printing/backend/cups_helper.cc ('k') | remoting/host/config_file_watcher_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 // In some cases CUPS failed to get ppd file. 239 // In some cases CUPS failed to get ppd file.
240 if (ppd_path.empty()) { 240 if (ppd_path.empty()) {
241 LOG(ERROR) << "CUPS: Failed to get PPD" 241 LOG(ERROR) << "CUPS: Failed to get PPD"
242 << ", printer name: " << printer_name; 242 << ", printer name: " << printer_name;
243 return false; 243 return false;
244 } 244 }
245 245
246 std::string content; 246 std::string content;
247 bool res = file_util::ReadFileToString(ppd_path, &content); 247 bool res = file_util::ReadFileToString(ppd_path, &content);
248 248
249 file_util::Delete(ppd_path, false); 249 base::Delete(ppd_path, false);
250 250
251 if (res) { 251 if (res) {
252 printer_info->printer_capabilities.swap(content); 252 printer_info->printer_capabilities.swap(content);
253 printer_info->caps_mime_type = "application/pagemaker"; 253 printer_info->caps_mime_type = "application/pagemaker";
254 // In CUPS, printer defaults is a part of PPD file. Nothing to upload here. 254 // In CUPS, printer defaults is a part of PPD file. Nothing to upload here.
255 printer_info->printer_defaults.clear(); 255 printer_info->printer_defaults.clear();
256 printer_info->defaults_mime_type.clear(); 256 printer_info->defaults_mime_type.clear();
257 } 257 }
258 258
259 return res; 259 return res;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 // since some http reponses are encoded and content_length > file size. 361 // since some http reponses are encoded and content_length > file size.
362 // Let's just check for the obvious CUPS and http errors here. 362 // Let's just check for the obvious CUPS and http errors here.
363 ppd_path = base::FilePath(ppd_file_path); 363 ppd_path = base::FilePath(ppd_file_path);
364 ipp_status_t error_code = cupsLastError(); 364 ipp_status_t error_code = cupsLastError();
365 int http_error = httpError(http.http()); 365 int http_error = httpError(http.http());
366 if (error_code > IPP_OK_EVENTS_COMPLETE || http_error != 0) { 366 if (error_code > IPP_OK_EVENTS_COMPLETE || http_error != 0) {
367 LOG(ERROR) << "Error downloading PPD file" 367 LOG(ERROR) << "Error downloading PPD file"
368 << ", name: " << name 368 << ", name: " << name
369 << ", CUPS error: " << static_cast<int>(error_code) 369 << ", CUPS error: " << static_cast<int>(error_code)
370 << ", HTTP error: " << http_error; 370 << ", HTTP error: " << http_error;
371 file_util::Delete(ppd_path, false); 371 base::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
OLDNEW
« no previous file with comments | « printing/backend/cups_helper.cc ('k') | remoting/host/config_file_watcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698