| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/md5.h" | 9 #include "base/md5.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 CloudPrintURLFetcher::ResponseAction | 410 CloudPrintURLFetcher::ResponseAction |
| 411 PrinterJobHandler::HandleSuccessStatusUpdateResponse( | 411 PrinterJobHandler::HandleSuccessStatusUpdateResponse( |
| 412 const URLFetcher* source, | 412 const URLFetcher* source, |
| 413 const GURL& url, | 413 const GURL& url, |
| 414 DictionaryValue* json_data, | 414 DictionaryValue* json_data, |
| 415 bool succeeded) { | 415 bool succeeded) { |
| 416 VLOG(1) << "CP_PROXY: Handle success status update response, id: " | 416 VLOG(1) << "CP_PROXY: Handle success status update response, id: " |
| 417 << printer_info_cloud_.printer_id; | 417 << printer_info_cloud_.printer_id; |
| 418 // The print job has been spooled locally. We now need to create an object | 418 // The print job has been spooled locally. We now need to create an object |
| 419 // that monitors the status of the job and updates the server. | 419 // that monitors the status of the job and updates the server. |
| 420 scoped_refptr<JobStatusUpdater> job_status_updater = | 420 scoped_refptr<JobStatusUpdater> job_status_updater( |
| 421 new JobStatusUpdater(printer_info_.printer_name, job_details_.job_id_, | 421 new JobStatusUpdater(printer_info_.printer_name, job_details_.job_id_, |
| 422 local_job_id_, auth_token_, cloud_print_server_url_, | 422 local_job_id_, auth_token_, cloud_print_server_url_, |
| 423 print_system_.get(), this); | 423 print_system_.get(), this)); |
| 424 job_status_updater_list_.push_back(job_status_updater); | 424 job_status_updater_list_.push_back(job_status_updater); |
| 425 MessageLoop::current()->PostTask( | 425 MessageLoop::current()->PostTask( |
| 426 FROM_HERE, NewRunnableMethod(job_status_updater.get(), | 426 FROM_HERE, NewRunnableMethod(job_status_updater.get(), |
| 427 &JobStatusUpdater::UpdateStatus)); | 427 &JobStatusUpdater::UpdateStatus)); |
| 428 if (succeeded) { | 428 if (succeeded) { |
| 429 // Since we just printed successfully, we want to look for more jobs. | 429 // Since we just printed successfully, we want to look for more jobs. |
| 430 server_job_available_ = true; | 430 server_job_available_ = true; |
| 431 } | 431 } |
| 432 MessageLoop::current()->PostTask( | 432 MessageLoop::current()->PostTask( |
| 433 FROM_HERE, NewRunnableMethod(this, &PrinterJobHandler::Stop)); | 433 FROM_HERE, NewRunnableMethod(this, &PrinterJobHandler::Stop)); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 } | 575 } |
| 576 | 576 |
| 577 void PrinterJobHandler::OnJobSpoolFailed() { | 577 void PrinterJobHandler::OnJobSpoolFailed() { |
| 578 DCHECK(MessageLoop::current() == print_thread_.message_loop()); | 578 DCHECK(MessageLoop::current() == print_thread_.message_loop()); |
| 579 job_spooler_ = NULL; | 579 job_spooler_ = NULL; |
| 580 job_handler_message_loop_proxy_->PostTask(FROM_HERE, | 580 job_handler_message_loop_proxy_->PostTask(FROM_HERE, |
| 581 NewRunnableMethod(this, | 581 NewRunnableMethod(this, |
| 582 &PrinterJobHandler::JobFailed, | 582 &PrinterJobHandler::JobFailed, |
| 583 PRINT_FAILED)); | 583 PRINT_FAILED)); |
| 584 } | 584 } |
| OLD | NEW |