Chromium Code Reviews| 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 #include "content/browser/service_worker/service_worker_provider_host.h" | 5 #include "content/browser/service_worker/service_worker_provider_host.h" |
| 6 | 6 |
| 7 #include "base/guid.h" | 7 #include "base/guid.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "content/browser/frame_host/frame_tree.h" | 9 #include "content/browser/frame_host/frame_tree.h" |
| 10 #include "content/browser/frame_host/frame_tree_node.h" | 10 #include "content/browser/frame_host/frame_tree_node.h" |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 300 for (; it != matching_registrations_.rend(); ++it) { | 300 for (; it != matching_registrations_.rend(); ++it) { |
| 301 if (it->second->is_uninstalled()) | 301 if (it->second->is_uninstalled()) |
| 302 continue; | 302 continue; |
| 303 if (it->second->is_uninstalling()) | 303 if (it->second->is_uninstalling()) |
| 304 return nullptr; | 304 return nullptr; |
| 305 return it->second.get(); | 305 return it->second.get(); |
| 306 } | 306 } |
| 307 return nullptr; | 307 return nullptr; |
| 308 } | 308 } |
| 309 | 309 |
| 310 void ServiceWorkerProviderHost::CopyMatchingRegistrations() { | |
| 311 DCHECK(context_); | |
| 312 const std::map<int64, ServiceWorkerRegistration*>& registrations = | |
| 313 context_->GetLiveRegistrations(); | |
| 314 for (auto& key_registration : registrations) { | |
|
falken
2015/06/24 02:24:26
nit: extra space. (i just always use "git-cl forma
michaeln
2015/06/24 19:47:22
does const auto& work?
xiang
2015/06/25 05:37:32
Done.
xiang
2015/06/25 05:37:32
Done.
| |
| 315 ServiceWorkerRegistration* registration = key_registration.second; | |
| 316 if (!registration->is_uninstalled() && | |
| 317 ServiceWorkerUtils::ScopeMatches(registration->pattern(), | |
| 318 document_url_)) | |
| 319 AddMatchingRegistration(registration); | |
| 320 } | |
| 321 } | |
| 322 | |
| 310 void ServiceWorkerProviderHost::NotifyControllerLost() { | 323 void ServiceWorkerProviderHost::NotifyControllerLost() { |
| 311 SetControllerVersionAttribute(nullptr, true /* notify_controllerchange */); | 324 SetControllerVersionAttribute(nullptr, true /* notify_controllerchange */); |
| 312 } | 325 } |
| 313 | 326 |
| 314 scoped_ptr<ServiceWorkerRequestHandler> | 327 scoped_ptr<ServiceWorkerRequestHandler> |
| 315 ServiceWorkerProviderHost::CreateRequestHandler( | 328 ServiceWorkerProviderHost::CreateRequestHandler( |
| 316 FetchRequestMode request_mode, | 329 FetchRequestMode request_mode, |
| 317 FetchCredentialsMode credentials_mode, | 330 FetchCredentialsMode credentials_mode, |
| 318 ResourceType resource_type, | 331 ResourceType resource_type, |
| 319 RequestContextType request_context_type, | 332 RequestContextType request_context_type, |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 660 return context_ != NULL; | 673 return context_ != NULL; |
| 661 } | 674 } |
| 662 | 675 |
| 663 void ServiceWorkerProviderHost::Send(IPC::Message* message) const { | 676 void ServiceWorkerProviderHost::Send(IPC::Message* message) const { |
| 664 DCHECK(dispatcher_host_); | 677 DCHECK(dispatcher_host_); |
| 665 DCHECK(IsReadyToSendMessages()); | 678 DCHECK(IsReadyToSendMessages()); |
| 666 dispatcher_host_->Send(message); | 679 dispatcher_host_->Send(message); |
| 667 } | 680 } |
| 668 | 681 |
| 669 } // namespace content | 682 } // namespace content |
| OLD | NEW |