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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/guid.h" | 9 #include "base/guid.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 DecreaseProcessReference(pattern); | 112 DecreaseProcessReference(pattern); |
113 } | 113 } |
114 | 114 |
115 int ServiceWorkerProviderHost::frame_id() const { | 115 int ServiceWorkerProviderHost::frame_id() const { |
116 if (provider_type_ == SERVICE_WORKER_PROVIDER_FOR_WINDOW) | 116 if (provider_type_ == SERVICE_WORKER_PROVIDER_FOR_WINDOW) |
117 return route_id_; | 117 return route_id_; |
118 return MSG_ROUTING_NONE; | 118 return MSG_ROUTING_NONE; |
119 } | 119 } |
120 | 120 |
121 bool ServiceWorkerProviderHost::IsContextSecureForServiceWorker() const { | 121 bool ServiceWorkerProviderHost::IsContextSecureForServiceWorker() const { |
122 DCHECK(document_url_.is_valid()); | 122 // |document_url_| may be empty if loading has not begun, or |
| 123 // ServiceWorkerRequestHandler didn't handle the load (because e.g. another |
| 124 // handler did first, or the initial request URL was such that |
| 125 // OriginCanAccessServiceWorkers returned false). |
| 126 if (!document_url_.is_valid()) |
| 127 return false; |
123 if (!OriginCanAccessServiceWorkers(document_url_)) | 128 if (!OriginCanAccessServiceWorkers(document_url_)) |
124 return false; | 129 return false; |
125 | 130 |
126 if (is_parent_frame_secure()) | 131 if (is_parent_frame_secure()) |
127 return true; | 132 return true; |
128 | 133 |
129 std::set<std::string> schemes; | 134 std::set<std::string> schemes; |
130 GetContentClient()->browser()->GetSchemesBypassingSecureContextCheckWhitelist( | 135 GetContentClient()->browser()->GetSchemesBypassingSecureContextCheckWhitelist( |
131 &schemes); | 136 &schemes); |
132 return schemes.find(document_url().scheme()) != schemes.end(); | 137 return schemes.find(document_url().scheme()) != schemes.end(); |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 Send(new ServiceWorkerMsg_SetControllerServiceWorker( | 673 Send(new ServiceWorkerMsg_SetControllerServiceWorker( |
669 render_thread_id_, provider_id(), | 674 render_thread_id_, provider_id(), |
670 GetOrCreateServiceWorkerHandle( | 675 GetOrCreateServiceWorkerHandle( |
671 associated_registration_->active_version()), | 676 associated_registration_->active_version()), |
672 false /* shouldNotifyControllerChange */)); | 677 false /* shouldNotifyControllerChange */)); |
673 } | 678 } |
674 } | 679 } |
675 } | 680 } |
676 | 681 |
677 } // namespace content | 682 } // namespace content |
OLD | NEW |