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 if (!document_url_.is_valid()) |
horo
2016/06/22 04:27:43
nit: Please add comments about when it happens.
| |
123 return false; | |
123 if (!OriginCanAccessServiceWorkers(document_url_)) | 124 if (!OriginCanAccessServiceWorkers(document_url_)) |
124 return false; | 125 return false; |
125 | 126 |
126 if (is_parent_frame_secure()) | 127 if (is_parent_frame_secure()) |
127 return true; | 128 return true; |
128 | 129 |
129 std::set<std::string> schemes; | 130 std::set<std::string> schemes; |
130 GetContentClient()->browser()->GetSchemesBypassingSecureContextCheckWhitelist( | 131 GetContentClient()->browser()->GetSchemesBypassingSecureContextCheckWhitelist( |
131 &schemes); | 132 &schemes); |
132 return schemes.find(document_url().scheme()) != schemes.end(); | 133 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( | 669 Send(new ServiceWorkerMsg_SetControllerServiceWorker( |
669 render_thread_id_, provider_id(), | 670 render_thread_id_, provider_id(), |
670 GetOrCreateServiceWorkerHandle( | 671 GetOrCreateServiceWorkerHandle( |
671 associated_registration_->active_version()), | 672 associated_registration_->active_version()), |
672 false /* shouldNotifyControllerChange */)); | 673 false /* shouldNotifyControllerChange */)); |
673 } | 674 } |
674 } | 675 } |
675 } | 676 } |
676 | 677 |
677 } // namespace content | 678 } // namespace content |
OLD | NEW |