OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_context_watcher.h" | 5 #include "content/browser/service_worker/service_worker_context_watcher.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/containers/scoped_ptr_hash_map.h" | 8 #include "base/containers/scoped_ptr_hash_map.h" |
9 #include "content/browser/service_worker/service_worker_context_observer.h" | 9 #include "content/browser/service_worker/service_worker_context_observer.h" |
10 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 10 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 int thread_id, | 203 int thread_id, |
204 const ErrorInfo& info) { | 204 const ErrorInfo& info) { |
205 int64 registration_id = kInvalidServiceWorkerRegistrationId; | 205 int64 registration_id = kInvalidServiceWorkerRegistrationId; |
206 if (ServiceWorkerVersionInfo* version = version_info_map_.get(version_id)) | 206 if (ServiceWorkerVersionInfo* version = version_info_map_.get(version_id)) |
207 registration_id = version->registration_id; | 207 registration_id = version->registration_id; |
208 BrowserThread::PostTask( | 208 BrowserThread::PostTask( |
209 BrowserThread::UI, FROM_HERE, | 209 BrowserThread::UI, FROM_HERE, |
210 base::Bind(error_callback_, registration_id, version_id, info)); | 210 base::Bind(error_callback_, registration_id, version_id, info)); |
211 } | 211 } |
212 | 212 |
| 213 void ServiceWorkerContextWatcher::OnVersionUpdateTimeSet( |
| 214 int64 version_id, |
| 215 base::Time update_time) { |
| 216 ServiceWorkerVersionInfo* version = version_info_map_.get(version_id); |
| 217 DCHECK(version); |
| 218 if (version->update_time == update_time) |
| 219 return; |
| 220 version->update_time = update_time; |
| 221 SendVersionInfo(*version); |
| 222 } |
| 223 |
213 void ServiceWorkerContextWatcher::OnRegistrationStored(int64 registration_id, | 224 void ServiceWorkerContextWatcher::OnRegistrationStored(int64 registration_id, |
214 const GURL& pattern) { | 225 const GURL& pattern) { |
215 SendRegistrationInfo(registration_id, pattern, | 226 SendRegistrationInfo(registration_id, pattern, |
216 ServiceWorkerRegistrationInfo::IS_NOT_DELETED); | 227 ServiceWorkerRegistrationInfo::IS_NOT_DELETED); |
217 } | 228 } |
218 | 229 |
219 void ServiceWorkerContextWatcher::OnRegistrationDeleted(int64 registration_id, | 230 void ServiceWorkerContextWatcher::OnRegistrationDeleted(int64 registration_id, |
220 const GURL& pattern) { | 231 const GURL& pattern) { |
221 SendRegistrationInfo(registration_id, pattern, | 232 SendRegistrationInfo(registration_id, pattern, |
222 ServiceWorkerRegistrationInfo::IS_DELETED); | 233 ServiceWorkerRegistrationInfo::IS_DELETED); |
223 } | 234 } |
224 | 235 |
225 } // namespace content | 236 } // namespace content |
OLD | NEW |