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

Side by Side Diff: chrome/service/cloud_print/printer_job_handler.cc

Issue 184563006: Move WriteFile and WriteFileDescriptor from file_util to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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
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 "chrome/service/cloud_print/printer_job_handler.h" 5 #include "chrome/service/cloud_print/printer_job_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 380
381 CloudPrintURLFetcher::ResponseAction 381 CloudPrintURLFetcher::ResponseAction
382 PrinterJobHandler::HandlePrintDataResponse(const net::URLFetcher* source, 382 PrinterJobHandler::HandlePrintDataResponse(const net::URLFetcher* source,
383 const GURL& url, 383 const GURL& url,
384 const std::string& data) { 384 const std::string& data) {
385 VLOG(1) << "CP_CONNECTOR: Handling print data response" 385 VLOG(1) << "CP_CONNECTOR: Handling print data response"
386 << ", printer id: " << printer_info_cloud_.printer_id; 386 << ", printer id: " << printer_info_cloud_.printer_id;
387 if (base::CreateTemporaryFile(&job_details_.print_data_file_path_)) { 387 if (base::CreateTemporaryFile(&job_details_.print_data_file_path_)) {
388 UMA_HISTOGRAM_ENUMERATION("CloudPrint.JobHandlerEvent", JOB_HANDLER_DATA, 388 UMA_HISTOGRAM_ENUMERATION("CloudPrint.JobHandlerEvent", JOB_HANDLER_DATA,
389 JOB_HANDLER_MAX); 389 JOB_HANDLER_MAX);
390 int ret = file_util::WriteFile(job_details_.print_data_file_path_, 390 int ret = base::WriteFile(job_details_.print_data_file_path_,
391 data.c_str(), data.length()); 391 data.c_str(), data.length());
392 source->GetResponseHeaders()->GetMimeType( 392 source->GetResponseHeaders()->GetMimeType(
393 &job_details_.print_data_mime_type_); 393 &job_details_.print_data_mime_type_);
394 DCHECK(ret == static_cast<int>(data.length())); 394 DCHECK(ret == static_cast<int>(data.length()));
395 if (ret == static_cast<int>(data.length())) { 395 if (ret == static_cast<int>(data.length())) {
396 UpdateJobStatus(PRINT_JOB_STATUS_IN_PROGRESS, JOB_SUCCESS); 396 UpdateJobStatus(PRINT_JOB_STATUS_IN_PROGRESS, JOB_SUCCESS);
397 return CloudPrintURLFetcher::STOP_PROCESSING; 397 return CloudPrintURLFetcher::STOP_PROCESSING;
398 } 398 }
399 } 399 }
400 UMA_HISTOGRAM_ENUMERATION("CloudPrint.JobHandlerEvent", 400 UMA_HISTOGRAM_ENUMERATION("CloudPrint.JobHandlerEvent",
401 JOB_HANDLER_INVALID_DATA, JOB_HANDLER_MAX); 401 JOB_HANDLER_INVALID_DATA, JOB_HANDLER_MAX);
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 job_details.print_data_mime_type_, 806 job_details.print_data_mime_type_,
807 printer_name, 807 printer_name,
808 base::UTF16ToUTF8(document_name), 808 base::UTF16ToUTF8(document_name),
809 job_details.tags_, 809 job_details.tags_,
810 this)) { 810 this)) {
811 OnJobSpoolFailed(); 811 OnJobSpoolFailed();
812 } 812 }
813 } 813 }
814 814
815 } // namespace cloud_print 815 } // namespace cloud_print
OLDNEW
« no previous file with comments | « chrome/service/cloud_print/connector_settings_unittest.cc ('k') | chrome/test/base/ui_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698