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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 base::Bind(error_callback_, registration_id, version_id, | 269 base::Bind(error_callback_, registration_id, version_id, |
270 ErrorInfo(message.message, message.line_number, -1, | 270 ErrorInfo(message.message, message.line_number, -1, |
271 message.source_url))); | 271 message.source_url))); |
272 } | 272 } |
273 | 273 |
274 void ServiceWorkerContextWatcher::OnControlleeAdded( | 274 void ServiceWorkerContextWatcher::OnControlleeAdded( |
275 int64_t version_id, | 275 int64_t version_id, |
276 const std::string& uuid, | 276 const std::string& uuid, |
277 int process_id, | 277 int process_id, |
278 int route_id, | 278 int route_id, |
| 279 const base::Callback<WebContents*(void)>& web_contents_getter, |
279 ServiceWorkerProviderType type) { | 280 ServiceWorkerProviderType type) { |
280 auto it = version_info_map_.find(version_id); | 281 auto it = version_info_map_.find(version_id); |
281 if (it == version_info_map_.end()) | 282 if (it == version_info_map_.end()) |
282 return; | 283 return; |
283 ServiceWorkerVersionInfo* version = it->second.get(); | 284 ServiceWorkerVersionInfo* version = it->second.get(); |
284 version->clients[uuid] = | 285 version->clients[uuid] = ServiceWorkerVersionInfo::ClientInfo( |
285 ServiceWorkerVersionInfo::ClientInfo(process_id, route_id, type); | 286 process_id, route_id, web_contents_getter, type); |
286 SendVersionInfo(*version); | 287 SendVersionInfo(*version); |
287 } | 288 } |
288 | 289 |
289 void ServiceWorkerContextWatcher::OnControlleeRemoved(int64_t version_id, | 290 void ServiceWorkerContextWatcher::OnControlleeRemoved(int64_t version_id, |
290 const std::string& uuid) { | 291 const std::string& uuid) { |
291 auto it = version_info_map_.find(version_id); | 292 auto it = version_info_map_.find(version_id); |
292 if (it == version_info_map_.end()) | 293 if (it == version_info_map_.end()) |
293 return; | 294 return; |
294 ServiceWorkerVersionInfo* version = it->second.get(); | 295 ServiceWorkerVersionInfo* version = it->second.get(); |
295 version->clients.erase(uuid); | 296 version->clients.erase(uuid); |
296 SendVersionInfo(*version); | 297 SendVersionInfo(*version); |
297 } | 298 } |
298 | 299 |
299 void ServiceWorkerContextWatcher::OnRegistrationStored(int64_t registration_id, | 300 void ServiceWorkerContextWatcher::OnRegistrationStored(int64_t registration_id, |
300 const GURL& pattern) { | 301 const GURL& pattern) { |
301 SendRegistrationInfo(registration_id, pattern, | 302 SendRegistrationInfo(registration_id, pattern, |
302 ServiceWorkerRegistrationInfo::IS_NOT_DELETED); | 303 ServiceWorkerRegistrationInfo::IS_NOT_DELETED); |
303 } | 304 } |
304 | 305 |
305 void ServiceWorkerContextWatcher::OnRegistrationDeleted(int64_t registration_id, | 306 void ServiceWorkerContextWatcher::OnRegistrationDeleted(int64_t registration_id, |
306 const GURL& pattern) { | 307 const GURL& pattern) { |
307 SendRegistrationInfo(registration_id, pattern, | 308 SendRegistrationInfo(registration_id, pattern, |
308 ServiceWorkerRegistrationInfo::IS_DELETED); | 309 ServiceWorkerRegistrationInfo::IS_DELETED); |
309 } | 310 } |
310 | 311 |
311 } // namespace content | 312 } // namespace content |
OLD | NEW |