OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_REGISTER_JOB_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_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" |
11 #include "content/browser/service_worker/embedded_worker_instance.h" | 11 #include "content/browser/service_worker/embedded_worker_instance.h" |
12 #include "content/browser/service_worker/service_worker_register_job_base.h" | 12 #include "content/browser/service_worker/service_worker_register_job_base.h" |
13 #include "content/browser/service_worker/service_worker_registration.h" | 13 #include "content/browser/service_worker/service_worker_registration.h" |
14 #include "content/common/service_worker/service_worker_status_code.h" | 14 #include "content/common/service_worker/service_worker_status_code.h" |
| 15 #include "content/public/browser/browser_main_runner.h" |
15 #include "url/gurl.h" | 16 #include "url/gurl.h" |
16 | 17 |
17 namespace content { | 18 namespace content { |
18 | 19 |
19 class ServiceWorkerJobCoordinator; | 20 class ServiceWorkerJobCoordinator; |
20 class ServiceWorkerStorage; | 21 class ServiceWorkerStorage; |
21 | 22 |
22 // Handles the initial registration of a Service Worker and the | 23 // Handles the initial registration of a Service Worker and the |
23 // subsequent update of existing registrations. | 24 // subsequent update of existing registrations. |
24 // | 25 // |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 scoped_refptr<ServiceWorkerVersion> new_version; | 98 scoped_refptr<ServiceWorkerVersion> new_version; |
98 }; | 99 }; |
99 | 100 |
100 void set_registration( | 101 void set_registration( |
101 const scoped_refptr<ServiceWorkerRegistration>& registration); | 102 const scoped_refptr<ServiceWorkerRegistration>& registration); |
102 ServiceWorkerRegistration* registration(); | 103 ServiceWorkerRegistration* registration(); |
103 void set_new_version(ServiceWorkerVersion* version); | 104 void set_new_version(ServiceWorkerVersion* version); |
104 ServiceWorkerVersion* new_version(); | 105 ServiceWorkerVersion* new_version(); |
105 | 106 |
106 void SetPhase(Phase phase); | 107 void SetPhase(Phase phase); |
| 108 void Restart(); |
107 | 109 |
108 void ContinueWithRegistration( | 110 void ContinueWithRegistration( |
109 ServiceWorkerStatusCode status, | 111 ServiceWorkerStatusCode status, |
110 const scoped_refptr<ServiceWorkerRegistration>& registration); | 112 const scoped_refptr<ServiceWorkerRegistration>& registration); |
111 void ContinueWithUpdate( | 113 void ContinueWithUpdate( |
112 ServiceWorkerStatusCode status, | 114 ServiceWorkerStatusCode status, |
113 const scoped_refptr<ServiceWorkerRegistration>& registration); | 115 const scoped_refptr<ServiceWorkerRegistration>& registration); |
114 void RegisterAndContinue(); | 116 void RegisterAndContinue(); |
115 void ContinueWithUninstallingRegistration( | 117 void ContinueWithUninstallingRegistration( |
116 const scoped_refptr<ServiceWorkerRegistration>& existing_registration, | 118 const scoped_refptr<ServiceWorkerRegistration>& existing_registration, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 const GURL script_url_; | 155 const GURL script_url_; |
154 std::vector<RegistrationCallback> callbacks_; | 156 std::vector<RegistrationCallback> callbacks_; |
155 Phase phase_; | 157 Phase phase_; |
156 Internal internal_; | 158 Internal internal_; |
157 bool doom_installing_worker_; | 159 bool doom_installing_worker_; |
158 bool is_promise_resolved_; | 160 bool is_promise_resolved_; |
159 bool should_uninstall_on_failure_; | 161 bool should_uninstall_on_failure_; |
160 ServiceWorkerStatusCode promise_resolved_status_; | 162 ServiceWorkerStatusCode promise_resolved_status_; |
161 std::string promise_resolved_status_message_; | 163 std::string promise_resolved_status_message_; |
162 scoped_refptr<ServiceWorkerRegistration> promise_resolved_registration_; | 164 scoped_refptr<ServiceWorkerRegistration> promise_resolved_registration_; |
| 165 base::OneShotTimer<ServiceWorkerRegisterJob> delayed_start_timer_; |
163 base::WeakPtrFactory<ServiceWorkerRegisterJob> weak_factory_; | 166 base::WeakPtrFactory<ServiceWorkerRegisterJob> weak_factory_; |
164 | 167 |
165 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegisterJob); | 168 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegisterJob); |
166 }; | 169 }; |
167 | 170 |
168 } // namespace content | 171 } // namespace content |
169 | 172 |
170 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_H_ | 173 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_H_ |
OLD | NEW |