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 16 matching lines...) Expand all Loading... | |
27 callbacks_.push_back(callback); | 27 callbacks_.push_back(callback); |
28 } | 28 } |
29 | 29 |
30 void ServiceWorkerUnregisterJob::Start() { | 30 void ServiceWorkerUnregisterJob::Start() { |
31 context_->storage()->FindRegistrationForPattern( | 31 context_->storage()->FindRegistrationForPattern( |
32 pattern_, | 32 pattern_, |
33 base::Bind(&ServiceWorkerUnregisterJob::DeleteExistingRegistration, | 33 base::Bind(&ServiceWorkerUnregisterJob::DeleteExistingRegistration, |
34 weak_factory_.GetWeakPtr())); | 34 weak_factory_.GetWeakPtr())); |
35 } | 35 } |
36 | 36 |
37 void ServiceWorkerUnregisterJob::Abort() { | |
38 for (std::vector<UnregistrationCallback>::iterator it = callbacks_.begin(); | |
39 it != callbacks_.end(); ++it) { | |
40 it->Run(SERVICE_WORKER_ERROR_ABORT); | |
falken
2014/06/19 03:45:56
Seems that we can go through Complete here too so
nhiroki
2014/06/19 05:53:09
Done.
| |
41 } | |
42 } | |
43 | |
37 bool ServiceWorkerUnregisterJob::Equals(ServiceWorkerRegisterJobBase* job) { | 44 bool ServiceWorkerUnregisterJob::Equals(ServiceWorkerRegisterJobBase* job) { |
38 if (job->GetType() != GetType()) | 45 if (job->GetType() != GetType()) |
39 return false; | 46 return false; |
40 return static_cast<ServiceWorkerUnregisterJob*>(job)->pattern_ == pattern_; | 47 return static_cast<ServiceWorkerUnregisterJob*>(job)->pattern_ == pattern_; |
41 } | 48 } |
42 | 49 |
43 RegistrationJobType ServiceWorkerUnregisterJob::GetType() { | 50 RegistrationJobType ServiceWorkerUnregisterJob::GetType() { |
44 return ServiceWorkerRegisterJobBase::UNREGISTRATION; | 51 return ServiceWorkerRegisterJobBase::UNREGISTRATION; |
45 } | 52 } |
46 | 53 |
(...skipping 25 matching lines...) Expand all Loading... | |
72 void ServiceWorkerUnregisterJob::Complete(ServiceWorkerStatusCode status) { | 79 void ServiceWorkerUnregisterJob::Complete(ServiceWorkerStatusCode status) { |
73 for (std::vector<UnregistrationCallback>::iterator it = callbacks_.begin(); | 80 for (std::vector<UnregistrationCallback>::iterator it = callbacks_.begin(); |
74 it != callbacks_.end(); | 81 it != callbacks_.end(); |
75 ++it) { | 82 ++it) { |
76 it->Run(status); | 83 it->Run(status); |
77 } | 84 } |
78 context_->job_coordinator()->FinishJob(pattern_, this); | 85 context_->job_coordinator()->FinishJob(pattern_, this); |
79 } | 86 } |
80 | 87 |
81 } // namespace content | 88 } // namespace content |
OLD | NEW |