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_REGISTRATION_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // registation, the method will reset that field to NULL, and notify | 102 // registation, the method will reset that field to NULL, and notify |
103 // listeners via OnVersionAttributesChanged. | 103 // listeners via OnVersionAttributesChanged. |
104 void UnsetVersion(ServiceWorkerVersion* version); | 104 void UnsetVersion(ServiceWorkerVersion* version); |
105 | 105 |
106 // Triggers the [[Activate]] algorithm when the currently active version | 106 // Triggers the [[Activate]] algorithm when the currently active version |
107 // has no controllees. If there are no controllees at the time the method | 107 // has no controllees. If there are no controllees at the time the method |
108 // is called or when version's skip waiting flag is set, activation is | 108 // is called or when version's skip waiting flag is set, activation is |
109 // initiated immediately. | 109 // initiated immediately. |
110 void ActivateWaitingVersionWhenReady(); | 110 void ActivateWaitingVersionWhenReady(); |
111 | 111 |
| 112 // Takes over control of provider hosts which are currently not controlled or |
| 113 // controlled by other registrations. |
| 114 void ClaimClients(const StatusCallback& callback); |
| 115 |
112 // Triggers the [[ClearRegistration]] algorithm when the currently | 116 // Triggers the [[ClearRegistration]] algorithm when the currently |
113 // active version has no controllees. Deletes this registration | 117 // active version has no controllees. Deletes this registration |
114 // from storage immediately. | 118 // from storage immediately. |
115 void ClearWhenReady(); | 119 void ClearWhenReady(); |
116 | 120 |
117 // Restores this registration in storage and cancels the pending | 121 // Restores this registration in storage and cancels the pending |
118 // [[ClearRegistration]] algorithm. | 122 // [[ClearRegistration]] algorithm. |
119 void AbortPendingClear(const StatusCallback& callback); | 123 void AbortPendingClear(const StatusCallback& callback); |
120 | 124 |
121 // The time of the most recent update check. | 125 // The time of the most recent update check. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 ServiceWorkerStatusCode status); | 160 ServiceWorkerStatusCode status); |
157 void OnDeleteFinished(ServiceWorkerStatusCode status); | 161 void OnDeleteFinished(ServiceWorkerStatusCode status); |
158 | 162 |
159 // This method corresponds to the [[ClearRegistration]] algorithm. | 163 // This method corresponds to the [[ClearRegistration]] algorithm. |
160 void Clear(); | 164 void Clear(); |
161 | 165 |
162 void OnRestoreFinished(const StatusCallback& callback, | 166 void OnRestoreFinished(const StatusCallback& callback, |
163 scoped_refptr<ServiceWorkerVersion> version, | 167 scoped_refptr<ServiceWorkerVersion> version, |
164 ServiceWorkerStatusCode status); | 168 ServiceWorkerStatusCode status); |
165 | 169 |
| 170 void DidGetRegistrationsForClaimClients( |
| 171 const StatusCallback& callback, |
| 172 scoped_refptr<ServiceWorkerVersion> version, |
| 173 const std::vector<ServiceWorkerRegistrationInfo>& registrations); |
| 174 bool ShouldClaim( |
| 175 ServiceWorkerProviderHost* provider_host, |
| 176 const std::vector<ServiceWorkerRegistrationInfo>& registration_infos); |
| 177 |
166 const GURL pattern_; | 178 const GURL pattern_; |
167 const int64 registration_id_; | 179 const int64 registration_id_; |
168 bool is_deleted_; | 180 bool is_deleted_; |
169 bool is_uninstalling_; | 181 bool is_uninstalling_; |
170 bool is_uninstalled_; | 182 bool is_uninstalled_; |
171 bool should_activate_when_ready_; | 183 bool should_activate_when_ready_; |
172 base::Time last_update_check_; | 184 base::Time last_update_check_; |
173 int64_t resources_total_size_bytes_; | 185 int64_t resources_total_size_bytes_; |
174 scoped_refptr<ServiceWorkerVersion> active_version_; | 186 scoped_refptr<ServiceWorkerVersion> active_version_; |
175 scoped_refptr<ServiceWorkerVersion> waiting_version_; | 187 scoped_refptr<ServiceWorkerVersion> waiting_version_; |
176 scoped_refptr<ServiceWorkerVersion> installing_version_; | 188 scoped_refptr<ServiceWorkerVersion> installing_version_; |
177 ObserverList<Listener> listeners_; | 189 ObserverList<Listener> listeners_; |
178 base::WeakPtr<ServiceWorkerContextCore> context_; | 190 base::WeakPtr<ServiceWorkerContextCore> context_; |
179 | 191 |
180 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistration); | 192 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistration); |
181 }; | 193 }; |
182 | 194 |
183 } // namespace content | 195 } // namespace content |
184 | 196 |
185 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_ | 197 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_ |
OLD | NEW |