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 23 matching lines...) Expand all Loading... |
34 weak_factory_.GetWeakPtr())); | 34 weak_factory_.GetWeakPtr())); |
35 } | 35 } |
36 | 36 |
37 bool ServiceWorkerUnregisterJob::Equals(ServiceWorkerRegisterJobBase* job) { | 37 bool ServiceWorkerUnregisterJob::Equals(ServiceWorkerRegisterJobBase* job) { |
38 if (job->GetType() != GetType()) | 38 if (job->GetType() != GetType()) |
39 return false; | 39 return false; |
40 return static_cast<ServiceWorkerUnregisterJob*>(job)->pattern_ == pattern_; | 40 return static_cast<ServiceWorkerUnregisterJob*>(job)->pattern_ == pattern_; |
41 } | 41 } |
42 | 42 |
43 RegistrationJobType ServiceWorkerUnregisterJob::GetType() { | 43 RegistrationJobType ServiceWorkerUnregisterJob::GetType() { |
44 return ServiceWorkerRegisterJobBase::UNREGISTER; | 44 return ServiceWorkerRegisterJobBase::UNREGISTRATION; |
45 } | 45 } |
46 | 46 |
47 void ServiceWorkerUnregisterJob::DeleteExistingRegistration( | 47 void ServiceWorkerUnregisterJob::DeleteExistingRegistration( |
48 ServiceWorkerStatusCode status, | 48 ServiceWorkerStatusCode status, |
49 const scoped_refptr<ServiceWorkerRegistration>& registration) { | 49 const scoped_refptr<ServiceWorkerRegistration>& registration) { |
50 if (status == SERVICE_WORKER_OK) { | 50 if (status == SERVICE_WORKER_OK) { |
51 registration->Shutdown(); | 51 registration->Shutdown(); |
52 context_->storage()->DeleteRegistration( | 52 context_->storage()->DeleteRegistration( |
53 pattern_, | 53 pattern_, |
54 base::Bind(&ServiceWorkerUnregisterJob::Complete, | 54 base::Bind(&ServiceWorkerUnregisterJob::Complete, |
(...skipping 13 matching lines...) Expand all Loading... |
68 void ServiceWorkerUnregisterJob::Complete(ServiceWorkerStatusCode status) { | 68 void ServiceWorkerUnregisterJob::Complete(ServiceWorkerStatusCode status) { |
69 for (std::vector<UnregistrationCallback>::iterator it = callbacks_.begin(); | 69 for (std::vector<UnregistrationCallback>::iterator it = callbacks_.begin(); |
70 it != callbacks_.end(); | 70 it != callbacks_.end(); |
71 ++it) { | 71 ++it) { |
72 it->Run(status); | 72 it->Run(status); |
73 } | 73 } |
74 context_->job_coordinator()->FinishJob(pattern_, this); | 74 context_->job_coordinator()->FinishJob(pattern_, this); |
75 } | 75 } |
76 | 76 |
77 } // namespace content | 77 } // namespace content |
OLD | NEW |