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 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_UNREGISTER_JOB_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_UNREGISTER_JOB_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_UNREGISTER_JOB_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_UNREGISTER_JOB_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 ServiceWorkerUnregisterJob(base::WeakPtr<ServiceWorkerContextCore> context, | 33 ServiceWorkerUnregisterJob(base::WeakPtr<ServiceWorkerContextCore> context, |
34 const GURL& pattern); | 34 const GURL& pattern); |
35 virtual ~ServiceWorkerUnregisterJob(); | 35 virtual ~ServiceWorkerUnregisterJob(); |
36 | 36 |
37 // Registers a callback to be called when the job completes (whether | 37 // Registers a callback to be called when the job completes (whether |
38 // successfully or not). Multiple callbacks may be registered. | 38 // successfully or not). Multiple callbacks may be registered. |
39 void AddCallback(const UnregistrationCallback& callback); | 39 void AddCallback(const UnregistrationCallback& callback); |
40 | 40 |
41 // ServiceWorkerRegisterJobBase implementation: | 41 // ServiceWorkerRegisterJobBase implementation: |
42 virtual void Start() OVERRIDE; | 42 virtual void Start() OVERRIDE; |
| 43 virtual void Abort() OVERRIDE; |
43 virtual bool Equals(ServiceWorkerRegisterJobBase* job) OVERRIDE; | 44 virtual bool Equals(ServiceWorkerRegisterJobBase* job) OVERRIDE; |
44 virtual RegistrationJobType GetType() OVERRIDE; | 45 virtual RegistrationJobType GetType() OVERRIDE; |
45 | 46 |
46 private: | 47 private: |
47 void DeleteExistingRegistration( | 48 void DeleteExistingRegistration( |
48 ServiceWorkerStatusCode status, | 49 ServiceWorkerStatusCode status, |
49 const scoped_refptr<ServiceWorkerRegistration>& registration); | 50 const scoped_refptr<ServiceWorkerRegistration>& registration); |
50 void Complete(ServiceWorkerStatusCode status); | 51 void Complete(ServiceWorkerStatusCode status); |
| 52 void CompleteInternal(ServiceWorkerStatusCode status); |
51 | 53 |
52 // The ServiceWorkerStorage object should always outlive this. | 54 // The ServiceWorkerStorage object should always outlive this. |
53 base::WeakPtr<ServiceWorkerContextCore> context_; | 55 base::WeakPtr<ServiceWorkerContextCore> context_; |
54 const GURL pattern_; | 56 const GURL pattern_; |
55 std::vector<UnregistrationCallback> callbacks_; | 57 std::vector<UnregistrationCallback> callbacks_; |
56 base::WeakPtrFactory<ServiceWorkerUnregisterJob> weak_factory_; | 58 base::WeakPtrFactory<ServiceWorkerUnregisterJob> weak_factory_; |
57 | 59 |
58 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerUnregisterJob); | 60 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerUnregisterJob); |
59 }; | 61 }; |
60 } // namespace content | 62 } // namespace content |
61 | 63 |
62 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_UNREGISTER_JOB_H_ | 64 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_UNREGISTER_JOB_H_ |
OLD | NEW |