| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/job_status_updater.h" | 5 #include "chrome/service/cloud_print/job_status_updater.h" |
| 6 | 6 |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 71 |
| 72 void JobStatusUpdater::Stop() { | 72 void JobStatusUpdater::Stop() { |
| 73 request_ = NULL; | 73 request_ = NULL; |
| 74 DCHECK(delegate_); | 74 DCHECK(delegate_); |
| 75 stopped_ = true; | 75 stopped_ = true; |
| 76 delegate_->OnJobCompleted(this); | 76 delegate_->OnJobCompleted(this); |
| 77 } | 77 } |
| 78 | 78 |
| 79 // CloudPrintURLFetcher::Delegate implementation. | 79 // CloudPrintURLFetcher::Delegate implementation. |
| 80 CloudPrintURLFetcher::ResponseAction JobStatusUpdater::HandleJSONData( | 80 CloudPrintURLFetcher::ResponseAction JobStatusUpdater::HandleJSONData( |
| 81 const URLFetcher* source, | 81 const content::URLFetcher* source, |
| 82 const GURL& url, | 82 const GURL& url, |
| 83 DictionaryValue* json_data, | 83 DictionaryValue* json_data, |
| 84 bool succeeded) { | 84 bool succeeded) { |
| 85 if (last_job_details_.status == cloud_print::PRINT_JOB_STATUS_COMPLETED) { | 85 if (last_job_details_.status == cloud_print::PRINT_JOB_STATUS_COMPLETED) { |
| 86 MessageLoop::current()->PostTask( | 86 MessageLoop::current()->PostTask( |
| 87 FROM_HERE, NewRunnableMethod(this, &JobStatusUpdater::Stop)); | 87 FROM_HERE, NewRunnableMethod(this, &JobStatusUpdater::Stop)); |
| 88 } | 88 } |
| 89 return CloudPrintURLFetcher::STOP_PROCESSING; | 89 return CloudPrintURLFetcher::STOP_PROCESSING; |
| 90 } | 90 } |
| 91 | 91 |
| 92 void JobStatusUpdater::OnRequestAuthError() { | 92 void JobStatusUpdater::OnRequestAuthError() { |
| 93 if (delegate_) | 93 if (delegate_) |
| 94 delegate_->OnAuthError(); | 94 delegate_->OnAuthError(); |
| 95 } | 95 } |
| OLD | NEW |