| 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 "content/browser/service_worker/service_worker_context_core.h" | 7 #include "content/browser/service_worker/service_worker_context_core.h" |
| 8 #include "content/browser/service_worker/service_worker_job_coordinator.h" | 8 #include "content/browser/service_worker/service_worker_job_coordinator.h" |
| 9 #include "content/browser/service_worker/service_worker_registration.h" | 9 #include "content/browser/service_worker/service_worker_registration.h" |
| 10 #include "content/browser/service_worker/service_worker_storage.h" | 10 #include "content/browser/service_worker/service_worker_storage.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 CompleteInternal(SERVICE_WORKER_ERROR_ABORT); | 38 CompleteInternal(SERVICE_WORKER_ERROR_ABORT); |
| 39 } | 39 } |
| 40 | 40 |
| 41 bool ServiceWorkerUnregisterJob::Equals(ServiceWorkerRegisterJobBase* job) { | 41 bool ServiceWorkerUnregisterJob::Equals(ServiceWorkerRegisterJobBase* job) { |
| 42 if (job->GetType() != GetType()) | 42 if (job->GetType() != GetType()) |
| 43 return false; | 43 return false; |
| 44 return static_cast<ServiceWorkerUnregisterJob*>(job)->pattern_ == pattern_; | 44 return static_cast<ServiceWorkerUnregisterJob*>(job)->pattern_ == pattern_; |
| 45 } | 45 } |
| 46 | 46 |
| 47 RegistrationJobType ServiceWorkerUnregisterJob::GetType() { | 47 RegistrationJobType ServiceWorkerUnregisterJob::GetType() { |
| 48 return ServiceWorkerRegisterJobBase::UNREGISTRATION; | 48 return UNREGISTRATION_JOB; |
| 49 } | 49 } |
| 50 | 50 |
| 51 void ServiceWorkerUnregisterJob::OnRegistrationFound( | 51 void ServiceWorkerUnregisterJob::OnRegistrationFound( |
| 52 ServiceWorkerStatusCode status, | 52 ServiceWorkerStatusCode status, |
| 53 const scoped_refptr<ServiceWorkerRegistration>& registration) { | 53 const scoped_refptr<ServiceWorkerRegistration>& registration) { |
| 54 if (status == SERVICE_WORKER_ERROR_NOT_FOUND) { | 54 if (status == SERVICE_WORKER_ERROR_NOT_FOUND) { |
| 55 DCHECK(!registration); | 55 DCHECK(!registration); |
| 56 Complete(SERVICE_WORKER_OK); | 56 Complete(SERVICE_WORKER_OK); |
| 57 return; | 57 return; |
| 58 } | 58 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 89 void ServiceWorkerUnregisterJob::CompleteInternal( | 89 void ServiceWorkerUnregisterJob::CompleteInternal( |
| 90 ServiceWorkerStatusCode status) { | 90 ServiceWorkerStatusCode status) { |
| 91 for (std::vector<UnregistrationCallback>::iterator it = callbacks_.begin(); | 91 for (std::vector<UnregistrationCallback>::iterator it = callbacks_.begin(); |
| 92 it != callbacks_.end(); | 92 it != callbacks_.end(); |
| 93 ++it) { | 93 ++it) { |
| 94 it->Run(status); | 94 it->Run(status); |
| 95 } | 95 } |
| 96 } | 96 } |
| 97 | 97 |
| 98 } // namespace content | 98 } // namespace content |
| OLD | NEW |