| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/service_worker/service_worker_unregister_job.h" | 5 #include "content/browser/service_worker/service_worker_unregister_job.h" |
| 6 | 6 |
| 7 #include "base/memory/weak_ptr.h" | 7 #include "base/memory/weak_ptr.h" |
| 8 #include "content/browser/service_worker/service_worker_context_core.h" | 8 #include "content/browser/service_worker/service_worker_context_core.h" |
| 9 #include "content/browser/service_worker/service_worker_job_coordinator.h" | 9 #include "content/browser/service_worker/service_worker_job_coordinator.h" |
| 10 #include "content/browser/service_worker/service_worker_registration.h" | 10 #include "content/browser/service_worker/service_worker_registration.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 return false; | 50 return false; |
| 51 return static_cast<ServiceWorkerUnregisterJob*>(job)->pattern_ == pattern_; | 51 return static_cast<ServiceWorkerUnregisterJob*>(job)->pattern_ == pattern_; |
| 52 } | 52 } |
| 53 | 53 |
| 54 RegistrationJobType ServiceWorkerUnregisterJob::GetType() const { | 54 RegistrationJobType ServiceWorkerUnregisterJob::GetType() const { |
| 55 return UNREGISTRATION_JOB; | 55 return UNREGISTRATION_JOB; |
| 56 } | 56 } |
| 57 | 57 |
| 58 void ServiceWorkerUnregisterJob::OnRegistrationFound( | 58 void ServiceWorkerUnregisterJob::OnRegistrationFound( |
| 59 ServiceWorkerStatusCode status, | 59 ServiceWorkerStatusCode status, |
| 60 const scoped_refptr<ServiceWorkerRegistration>& registration) { | 60 scoped_refptr<ServiceWorkerRegistration> registration) { |
| 61 if (status == SERVICE_WORKER_ERROR_NOT_FOUND) { | 61 if (status == SERVICE_WORKER_ERROR_NOT_FOUND) { |
| 62 DCHECK(!registration.get()); | 62 DCHECK(!registration.get()); |
| 63 Complete(kInvalidServiceWorkerRegistrationId, | 63 Complete(kInvalidServiceWorkerRegistrationId, |
| 64 SERVICE_WORKER_ERROR_NOT_FOUND); | 64 SERVICE_WORKER_ERROR_NOT_FOUND); |
| 65 return; | 65 return; |
| 66 } | 66 } |
| 67 | 67 |
| 68 if (status != SERVICE_WORKER_OK || registration->is_uninstalling()) { | 68 if (status != SERVICE_WORKER_OK || registration->is_uninstalling()) { |
| 69 Complete(kInvalidServiceWorkerRegistrationId, status); | 69 Complete(kInvalidServiceWorkerRegistrationId, status); |
| 70 return; | 70 return; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 99 DCHECK(!is_promise_resolved_); | 99 DCHECK(!is_promise_resolved_); |
| 100 is_promise_resolved_ = true; | 100 is_promise_resolved_ = true; |
| 101 for (std::vector<UnregistrationCallback>::iterator it = callbacks_.begin(); | 101 for (std::vector<UnregistrationCallback>::iterator it = callbacks_.begin(); |
| 102 it != callbacks_.end(); | 102 it != callbacks_.end(); |
| 103 ++it) { | 103 ++it) { |
| 104 it->Run(registration_id, status); | 104 it->Run(registration_id, status); |
| 105 } | 105 } |
| 106 } | 106 } |
| 107 | 107 |
| 108 } // namespace content | 108 } // namespace content |
| OLD | NEW |