| 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 } | 50 } |
| 51 | 51 |
| 52 RegistrationJobType ServiceWorkerUnregisterJob::GetType() { | 52 RegistrationJobType ServiceWorkerUnregisterJob::GetType() { |
| 53 return UNREGISTRATION_JOB; | 53 return UNREGISTRATION_JOB; |
| 54 } | 54 } |
| 55 | 55 |
| 56 void ServiceWorkerUnregisterJob::OnRegistrationFound( | 56 void ServiceWorkerUnregisterJob::OnRegistrationFound( |
| 57 ServiceWorkerStatusCode status, | 57 ServiceWorkerStatusCode status, |
| 58 const scoped_refptr<ServiceWorkerRegistration>& registration) { | 58 const scoped_refptr<ServiceWorkerRegistration>& registration) { |
| 59 if (status == SERVICE_WORKER_ERROR_NOT_FOUND) { | 59 if (status == SERVICE_WORKER_ERROR_NOT_FOUND) { |
| 60 DCHECK(!registration); | 60 DCHECK(!registration.get()); |
| 61 Complete(SERVICE_WORKER_OK); | 61 Complete(SERVICE_WORKER_OK); |
| 62 return; | 62 return; |
| 63 } | 63 } |
| 64 | 64 |
| 65 if (status != SERVICE_WORKER_OK || registration->is_uninstalling()) { | 65 if (status != SERVICE_WORKER_OK || registration->is_uninstalling()) { |
| 66 Complete(status); | 66 Complete(status); |
| 67 return; | 67 return; |
| 68 } | 68 } |
| 69 | 69 |
| 70 // TODO: "7. If registration.updatePromise is not null..." | 70 // TODO: "7. If registration.updatePromise is not null..." |
| (...skipping 22 matching lines...) Expand all Loading... |
| 93 DCHECK(!is_promise_resolved_); | 93 DCHECK(!is_promise_resolved_); |
| 94 is_promise_resolved_ = true; | 94 is_promise_resolved_ = true; |
| 95 for (std::vector<UnregistrationCallback>::iterator it = callbacks_.begin(); | 95 for (std::vector<UnregistrationCallback>::iterator it = callbacks_.begin(); |
| 96 it != callbacks_.end(); | 96 it != callbacks_.end(); |
| 97 ++it) { | 97 ++it) { |
| 98 it->Run(status); | 98 it->Run(status); |
| 99 } | 99 } |
| 100 } | 100 } |
| 101 | 101 |
| 102 } // namespace content | 102 } // namespace content |
| OLD | NEW |