Chromium Code Reviews| Index: chrome/service/cloud_print/printer_job_handler.cc |
| diff --git a/chrome/service/cloud_print/printer_job_handler.cc b/chrome/service/cloud_print/printer_job_handler.cc |
| index 035355b077f00b3c534373925b0dc2dd9240907d..2261c1f04381898c2e7b1f1aef7bfa6a2e5214f1 100644 |
| --- a/chrome/service/cloud_print/printer_job_handler.cc |
| +++ b/chrome/service/cloud_print/printer_job_handler.cc |
| @@ -281,7 +281,7 @@ PrinterJobHandler::HandleJobMetadataResponse( |
| } |
| } |
| SetNextDataHandler(&PrinterJobHandler::HandlePrintTicketResponse); |
| - request_ = new CloudPrintURLFetcher; |
| + request_ = CreateCloudPrintURLFetcher(); |
| request_->StartGetRequest(GURL(print_ticket_url.c_str()), |
| this, |
| kCloudPrintAPIMaxRetryCount, |
| @@ -308,7 +308,7 @@ PrinterJobHandler::HandlePrintTicketResponse(const net::URLFetcher* source, |
| if (print_system_->ValidatePrintTicket(printer_info_.printer_name, data)) { |
| job_details_.print_ticket_ = data; |
| SetNextDataHandler(&PrinterJobHandler::HandlePrintDataResponse); |
| - request_ = new CloudPrintURLFetcher; |
| + request_ = CreateCloudPrintURLFetcher(); |
| std::string accept_headers = "Accept: "; |
| accept_headers += print_system_->GetSupportedMimeTypes(); |
| request_->StartGetRequest(GURL(print_data_url_.c_str()), |
| @@ -422,7 +422,7 @@ void PrinterJobHandler::Start() { |
| job_check_pending_ = false; |
| // We need to fetch any pending jobs for this printer |
| SetNextJSONHandler(&PrinterJobHandler::HandleJobMetadataResponse); |
| - request_ = new CloudPrintURLFetcher; |
| + request_ = CreateCloudPrintURLFetcher(); |
| request_->StartGetRequest( |
| GetUrlForJobFetch( |
| cloud_print_server_url_, printer_info_cloud_.printer_id, |
| @@ -504,7 +504,7 @@ void PrinterJobHandler::UpdateJobStatus(PrintJobStatus status, |
| SetNextJSONHandler( |
| &PrinterJobHandler::HandleFailureStatusUpdateResponse); |
| } |
| - request_ = new CloudPrintURLFetcher; |
| + request_ = CreateCloudPrintURLFetcher(); |
| request_->StartGetRequest(GetUrlForJobStatusUpdate(cloud_print_server_url_, |
| job_details_.job_id_, |
| status), |
| @@ -652,7 +652,7 @@ void PrinterJobHandler::OnReceivePrinterCaps( |
| std::string mime_type("multipart/form-data; boundary="); |
| mime_type += mime_boundary; |
| SetNextJSONHandler(&PrinterJobHandler::HandlePrinterUpdateResponse); |
| - request_ = new CloudPrintURLFetcher; |
| + request_ = CreateCloudPrintURLFetcher(); |
| request_->StartPostRequest( |
| GetUrlForPrinterUpdate( |
| cloud_print_server_url_, printer_info_cloud_.printer_id), |
| @@ -697,4 +697,8 @@ void PrinterJobHandler::DoPrint(const JobDetails& job_details, |
| } |
| } |
| +CloudPrintURLFetcher* PrinterJobHandler::CreateCloudPrintURLFetcher() { |
|
Vitaly Buka (NO REVIEWS)
2013/02/08 22:38:56
Maybe also to use static factory for tests?
|
| + return new CloudPrintURLFetcher; |
| +} |
| + |
| } // namespace cloud_print |