| 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_version.h" | 5 #include "content/browser/service_worker/service_worker_version.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1037 callback.Run(status); | 1037 callback.Run(status); |
| 1038 } | 1038 } |
| 1039 | 1039 |
| 1040 void ServiceWorkerVersion::CountFeature(uint32_t feature) { | 1040 void ServiceWorkerVersion::CountFeature(uint32_t feature) { |
| 1041 if (!used_features_.insert(feature).second) | 1041 if (!used_features_.insert(feature).second) |
| 1042 return; | 1042 return; |
| 1043 for (auto provider_host_by_uuid : controllee_map_) | 1043 for (auto provider_host_by_uuid : controllee_map_) |
| 1044 provider_host_by_uuid.second->CountFeature(feature); | 1044 provider_host_by_uuid.second->CountFeature(feature); |
| 1045 } | 1045 } |
| 1046 | 1046 |
| 1047 void ServiceWorkerVersion::OnOpenWindow(int request_id, GURL url) { | 1047 void ServiceWorkerVersion::OnOpenWindow(int request_id, |
| 1048 GURL redirect_url, |
| 1049 GURL url) { |
| 1048 // Just abort if we are shutting down. | 1050 // Just abort if we are shutting down. |
| 1049 if (!context_) | 1051 if (!context_) |
| 1050 return; | 1052 return; |
| 1051 | 1053 |
| 1052 if (!url.is_valid()) { | 1054 if (!url.is_valid()) { |
| 1053 DVLOG(1) << "Received unexpected invalid URL from renderer process."; | 1055 DVLOG(1) << "Received unexpected invalid URL from renderer process."; |
| 1054 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 1056 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 1055 base::Bind(&KillEmbeddedWorkerProcess, | 1057 base::Bind(&KillEmbeddedWorkerProcess, |
| 1056 embedded_worker_->process_id(), | 1058 embedded_worker_->process_id(), |
| 1057 RESULT_CODE_KILLED_BAD_MESSAGE)); | 1059 RESULT_CODE_KILLED_BAD_MESSAGE)); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1068 // slightly different. For example, the view-source scheme will not be | 1070 // slightly different. For example, the view-source scheme will not be |
| 1069 // filtered out by Blink. | 1071 // filtered out by Blink. |
| 1070 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanRequestURL( | 1072 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanRequestURL( |
| 1071 embedded_worker_->process_id(), url)) { | 1073 embedded_worker_->process_id(), url)) { |
| 1072 embedded_worker_->SendMessage(ServiceWorkerMsg_OpenWindowError( | 1074 embedded_worker_->SendMessage(ServiceWorkerMsg_OpenWindowError( |
| 1073 request_id, url.spec() + " cannot be opened.")); | 1075 request_id, url.spec() + " cannot be opened.")); |
| 1074 return; | 1076 return; |
| 1075 } | 1077 } |
| 1076 | 1078 |
| 1077 service_worker_client_utils::OpenWindow( | 1079 service_worker_client_utils::OpenWindow( |
| 1078 url, script_url_, embedded_worker_->process_id(), context_, | 1080 redirect_url, url, script_url_, embedded_worker_->process_id(), context_, |
| 1079 base::Bind(&ServiceWorkerVersion::OnOpenWindowFinished, | 1081 base::Bind(&ServiceWorkerVersion::OnOpenWindowFinished, |
| 1080 weak_factory_.GetWeakPtr(), request_id)); | 1082 weak_factory_.GetWeakPtr(), request_id)); |
| 1081 } | 1083 } |
| 1082 | 1084 |
| 1083 void ServiceWorkerVersion::OnOpenWindowFinished( | 1085 void ServiceWorkerVersion::OnOpenWindowFinished( |
| 1084 int request_id, | 1086 int request_id, |
| 1085 ServiceWorkerStatusCode status, | 1087 ServiceWorkerStatusCode status, |
| 1086 const ServiceWorkerClientInfo& client_info) { | 1088 const ServiceWorkerClientInfo& client_info) { |
| 1087 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 1089 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 1088 | 1090 |
| (...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1818 | 1820 |
| 1819 void ServiceWorkerVersion::CleanUpExternalRequest( | 1821 void ServiceWorkerVersion::CleanUpExternalRequest( |
| 1820 const std::string& request_uuid, | 1822 const std::string& request_uuid, |
| 1821 ServiceWorkerStatusCode status) { | 1823 ServiceWorkerStatusCode status) { |
| 1822 if (status == SERVICE_WORKER_OK) | 1824 if (status == SERVICE_WORKER_OK) |
| 1823 return; | 1825 return; |
| 1824 external_request_uuid_to_request_id_.erase(request_uuid); | 1826 external_request_uuid_to_request_id_.erase(request_uuid); |
| 1825 } | 1827 } |
| 1826 | 1828 |
| 1827 } // namespace content | 1829 } // namespace content |
| OLD | NEW |