| 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/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 job_status_updater_list_.front()->Stop(); | 128 job_status_updater_list_.front()->Stop(); |
| 129 } | 129 } |
| 130 } | 130 } |
| 131 | 131 |
| 132 // CloudPrintURLFetcher::Delegate implementation. | 132 // CloudPrintURLFetcher::Delegate implementation. |
| 133 CloudPrintURLFetcher::ResponseAction PrinterJobHandler::HandleRawResponse( | 133 CloudPrintURLFetcher::ResponseAction PrinterJobHandler::HandleRawResponse( |
| 134 const net::URLFetcher* source, | 134 const net::URLFetcher* source, |
| 135 const GURL& url, | 135 const GURL& url, |
| 136 const net::URLRequestStatus& status, | 136 const net::URLRequestStatus& status, |
| 137 int response_code, | 137 int response_code, |
| 138 const net::ResponseCookies& cookies, | |
| 139 const std::string& data) { | 138 const std::string& data) { |
| 140 // 415 (Unsupported media type) error while fetching data from the server | 139 // 415 (Unsupported media type) error while fetching data from the server |
| 141 // means data conversion error. Stop fetching process and mark job as error. | 140 // means data conversion error. Stop fetching process and mark job as error. |
| 142 if (next_data_handler_ == (&PrinterJobHandler::HandlePrintDataResponse) && | 141 if (next_data_handler_ == (&PrinterJobHandler::HandlePrintDataResponse) && |
| 143 response_code == net::HTTP_UNSUPPORTED_MEDIA_TYPE) { | 142 response_code == net::HTTP_UNSUPPORTED_MEDIA_TYPE) { |
| 144 VLOG(1) << "CP_CONNECTOR: Job failed (unsupported media type)"; | 143 VLOG(1) << "CP_CONNECTOR: Job failed (unsupported media type)"; |
| 145 base::ThreadTaskRunnerHandle::Get()->PostTask( | 144 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 146 FROM_HERE, | 145 FROM_HERE, |
| 147 base::Bind(&PrinterJobHandler::JobFailed, this, JOB_DOWNLOAD_FAILED)); | 146 base::Bind(&PrinterJobHandler::JobFailed, this, JOB_DOWNLOAD_FAILED)); |
| 148 return CloudPrintURLFetcher::STOP_PROCESSING; | 147 return CloudPrintURLFetcher::STOP_PROCESSING; |
| (...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 this)) { | 808 this)) { |
| 810 OnJobSpoolFailed(); | 809 OnJobSpoolFailed(); |
| 811 } | 810 } |
| 812 } | 811 } |
| 813 | 812 |
| 814 bool PrinterJobHandler::CurrentlyOnPrintThread() const { | 813 bool PrinterJobHandler::CurrentlyOnPrintThread() const { |
| 815 return base::MessageLoop::current() == print_thread_.message_loop(); | 814 return base::MessageLoop::current() == print_thread_.message_loop(); |
| 816 } | 815 } |
| 817 | 816 |
| 818 } // namespace cloud_print | 817 } // namespace cloud_print |
| OLD | NEW |