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 "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 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
766 // access any members other than |job_handler_message_loop_proxy_|, | 766 // access any members other than |job_handler_message_loop_proxy_|, |
767 // |job_spooler_| and |print_system_|. | 767 // |job_spooler_| and |print_system_|. |
768 void PrinterJobHandler::DoPrint(const JobDetails& job_details, | 768 void PrinterJobHandler::DoPrint(const JobDetails& job_details, |
769 const std::string& printer_name) { | 769 const std::string& printer_name) { |
770 job_spooler_ = print_system_->CreateJobSpooler(); | 770 job_spooler_ = print_system_->CreateJobSpooler(); |
771 UMA_HISTOGRAM_LONG_TIMES("CloudPrint.PrepareTime", | 771 UMA_HISTOGRAM_LONG_TIMES("CloudPrint.PrepareTime", |
772 base::Time::Now() - job_start_time_); | 772 base::Time::Now() - job_start_time_); |
773 DCHECK(job_spooler_.get()); | 773 DCHECK(job_spooler_.get()); |
774 if (!job_spooler_.get()) | 774 if (!job_spooler_.get()) |
775 return; | 775 return; |
776 string16 document_name = | 776 base::string16 document_name = |
777 printing::SimplifyDocumentTitle(UTF8ToUTF16(job_details.job_title_)); | 777 printing::SimplifyDocumentTitle(UTF8ToUTF16(job_details.job_title_)); |
778 if (document_name.empty()) { | 778 if (document_name.empty()) { |
779 document_name = printing::SimplifyDocumentTitle( | 779 document_name = printing::SimplifyDocumentTitle( |
780 l10n_util::GetStringUTF16(IDS_DEFAULT_PRINT_DOCUMENT_TITLE)); | 780 l10n_util::GetStringUTF16(IDS_DEFAULT_PRINT_DOCUMENT_TITLE)); |
781 } | 781 } |
782 UMA_HISTOGRAM_ENUMERATION("CloudPrint.JobHandlerEvent", | 782 UMA_HISTOGRAM_ENUMERATION("CloudPrint.JobHandlerEvent", |
783 JOB_HANDLER_START_SPOOLING, JOB_HANDLER_MAX); | 783 JOB_HANDLER_START_SPOOLING, JOB_HANDLER_MAX); |
784 spooling_start_time_ = base::Time::Now(); | 784 spooling_start_time_ = base::Time::Now(); |
785 if (!job_spooler_->Spool(job_details.print_ticket_, | 785 if (!job_spooler_->Spool(job_details.print_ticket_, |
786 job_details.print_data_file_path_, | 786 job_details.print_data_file_path_, |
787 job_details.print_data_mime_type_, | 787 job_details.print_data_mime_type_, |
788 printer_name, | 788 printer_name, |
789 UTF16ToUTF8(document_name), | 789 UTF16ToUTF8(document_name), |
790 job_details.tags_, | 790 job_details.tags_, |
791 this)) { | 791 this)) { |
792 OnJobSpoolFailed(); | 792 OnJobSpoolFailed(); |
793 } | 793 } |
794 } | 794 } |
795 | 795 |
796 } // namespace cloud_print | 796 } // namespace cloud_print |
OLD | NEW |