OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading | 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading |
6 | 6 |
7 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 7 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 #include "net/url_request/url_request_job_factory.h" | 76 #include "net/url_request/url_request_job_factory.h" |
77 #include "webkit/appcache/appcache_interceptor.h" | 77 #include "webkit/appcache/appcache_interceptor.h" |
78 #include "webkit/appcache/appcache_interfaces.h" | 78 #include "webkit/appcache/appcache_interfaces.h" |
79 #include "webkit/blob/blob_storage_controller.h" | 79 #include "webkit/blob/blob_storage_controller.h" |
80 #include "webkit/blob/deletable_file_reference.h" | 80 #include "webkit/blob/deletable_file_reference.h" |
81 | 81 |
82 using base::Time; | 82 using base::Time; |
83 using base::TimeDelta; | 83 using base::TimeDelta; |
84 using base::TimeTicks; | 84 using base::TimeTicks; |
85 using content::BrowserThread; | 85 using content::BrowserThread; |
| 86 using content::ResourceResponse; |
86 using webkit_blob::DeletableFileReference; | 87 using webkit_blob::DeletableFileReference; |
87 | 88 |
88 // ---------------------------------------------------------------------------- | 89 // ---------------------------------------------------------------------------- |
89 | 90 |
90 // A ShutdownTask proxies a shutdown task from the UI thread to the IO thread. | 91 // A ShutdownTask proxies a shutdown task from the UI thread to the IO thread. |
91 // It should be constructed on the UI thread and run in the IO thread. | 92 // It should be constructed on the UI thread and run in the IO thread. |
92 class ResourceDispatcherHost::ShutdownTask : public Task { | 93 class ResourceDispatcherHost::ShutdownTask : public Task { |
93 public: | 94 public: |
94 explicit ShutdownTask(ResourceDispatcherHost* resource_dispatcher_host) | 95 explicit ShutdownTask(ResourceDispatcherHost* resource_dispatcher_host) |
95 : rdh_(resource_dispatcher_host) { | 96 : rdh_(resource_dispatcher_host) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 }; | 135 }; |
135 | 136 |
136 // Aborts a request before an URLRequest has actually been created. | 137 // Aborts a request before an URLRequest has actually been created. |
137 void AbortRequestBeforeItStarts(ResourceMessageFilter* filter, | 138 void AbortRequestBeforeItStarts(ResourceMessageFilter* filter, |
138 IPC::Message* sync_result, | 139 IPC::Message* sync_result, |
139 int route_id, | 140 int route_id, |
140 int request_id) { | 141 int request_id) { |
141 net::URLRequestStatus status(net::URLRequestStatus::FAILED, | 142 net::URLRequestStatus status(net::URLRequestStatus::FAILED, |
142 net::ERR_ABORTED); | 143 net::ERR_ABORTED); |
143 if (sync_result) { | 144 if (sync_result) { |
144 SyncLoadResult result; | 145 content::SyncLoadResult result; |
145 result.status = status; | 146 result.status = status; |
146 ResourceHostMsg_SyncLoad::WriteReplyParams(sync_result, result); | 147 ResourceHostMsg_SyncLoad::WriteReplyParams(sync_result, result); |
147 filter->Send(sync_result); | 148 filter->Send(sync_result); |
148 } else { | 149 } else { |
149 // Tell the renderer that this request was disallowed. | 150 // Tell the renderer that this request was disallowed. |
150 filter->Send(new ResourceMsg_RequestComplete( | 151 filter->Send(new ResourceMsg_RequestComplete( |
151 route_id, | 152 route_id, |
152 request_id, | 153 request_id, |
153 status, | 154 status, |
154 std::string(), // No security info needed, connection was not | 155 std::string(), // No security info needed, connection was not |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 return false; | 196 return false; |
196 } | 197 } |
197 } | 198 } |
198 } | 199 } |
199 | 200 |
200 return true; | 201 return true; |
201 } | 202 } |
202 | 203 |
203 void PopulateResourceResponse(net::URLRequest* request, | 204 void PopulateResourceResponse(net::URLRequest* request, |
204 ResourceResponse* response) { | 205 ResourceResponse* response) { |
205 response->response_head.status = request->status(); | 206 response->status = request->status(); |
206 response->response_head.request_time = request->request_time(); | 207 response->request_time = request->request_time(); |
207 response->response_head.response_time = request->response_time(); | 208 response->response_time = request->response_time(); |
208 response->response_head.headers = request->response_headers(); | 209 response->headers = request->response_headers(); |
209 request->GetCharset(&response->response_head.charset); | 210 request->GetCharset(&response->charset); |
210 response->response_head.content_length = request->GetExpectedContentSize(); | 211 response->content_length = request->GetExpectedContentSize(); |
211 request->GetMimeType(&response->response_head.mime_type); | 212 request->GetMimeType(&response->mime_type); |
212 response->response_head.was_fetched_via_spdy = | 213 response->was_fetched_via_spdy = request->was_fetched_via_spdy(); |
213 request->was_fetched_via_spdy(); | 214 response->was_npn_negotiated = request->was_npn_negotiated(); |
214 response->response_head.was_npn_negotiated = request->was_npn_negotiated(); | 215 response->was_fetched_via_proxy = request->was_fetched_via_proxy(); |
215 response->response_head.was_fetched_via_proxy = | 216 response->socket_address = request->GetSocketAddress(); |
216 request->was_fetched_via_proxy(); | |
217 response->response_head.socket_address = request->GetSocketAddress(); | |
218 appcache::AppCacheInterceptor::GetExtraResponseInfo( | 217 appcache::AppCacheInterceptor::GetExtraResponseInfo( |
219 request, | 218 request, |
220 &response->response_head.appcache_id, | 219 &response->appcache_id, |
221 &response->response_head.appcache_manifest_url); | 220 &response->appcache_manifest_url); |
222 } | 221 } |
223 | 222 |
224 void RemoveDownloadFileFromChildSecurityPolicy(int child_id, | 223 void RemoveDownloadFileFromChildSecurityPolicy(int child_id, |
225 const FilePath& path) { | 224 const FilePath& path) { |
226 ChildProcessSecurityPolicy::GetInstance()->RevokeAllPermissionsForFile( | 225 ChildProcessSecurityPolicy::GetInstance()->RevokeAllPermissionsForFile( |
227 child_id, path); | 226 child_id, path); |
228 } | 227 } |
229 | 228 |
230 #if defined(OS_WIN) | 229 #if defined(OS_WIN) |
231 #pragma warning(disable: 4748) | 230 #pragma warning(disable: 4748) |
(...skipping 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1396 bool ResourceDispatcherHost::CompleteResponseStarted(net::URLRequest* request) { | 1395 bool ResourceDispatcherHost::CompleteResponseStarted(net::URLRequest* request) { |
1397 ResourceDispatcherHostRequestInfo* info = InfoForRequest(request); | 1396 ResourceDispatcherHostRequestInfo* info = InfoForRequest(request); |
1398 | 1397 |
1399 scoped_refptr<ResourceResponse> response(new ResourceResponse); | 1398 scoped_refptr<ResourceResponse> response(new ResourceResponse); |
1400 PopulateResourceResponse(request, response); | 1399 PopulateResourceResponse(request, response); |
1401 | 1400 |
1402 if (request->ssl_info().cert) { | 1401 if (request->ssl_info().cert) { |
1403 int cert_id = | 1402 int cert_id = |
1404 CertStore::GetInstance()->StoreCert(request->ssl_info().cert, | 1403 CertStore::GetInstance()->StoreCert(request->ssl_info().cert, |
1405 info->child_id()); | 1404 info->child_id()); |
1406 response->response_head.security_info = | 1405 response->security_info = |
1407 SSLManager::SerializeSecurityInfo( | 1406 SSLManager::SerializeSecurityInfo( |
1408 cert_id, request->ssl_info().cert_status, | 1407 cert_id, request->ssl_info().cert_status, |
1409 request->ssl_info().security_bits, | 1408 request->ssl_info().security_bits, |
1410 request->ssl_info().connection_status); | 1409 request->ssl_info().connection_status); |
1411 } else { | 1410 } else { |
1412 // We should not have any SSL state. | 1411 // We should not have any SSL state. |
1413 DCHECK(!request->ssl_info().cert_status && | 1412 DCHECK(!request->ssl_info().cert_status && |
1414 request->ssl_info().security_bits == -1 && | 1413 request->ssl_info().security_bits == -1 && |
1415 !request->ssl_info().connection_status); | 1414 !request->ssl_info().connection_status); |
1416 } | 1415 } |
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2169 return HTTP_AUTH_RESOURCE_BLOCKED_CROSS; | 2168 return HTTP_AUTH_RESOURCE_BLOCKED_CROSS; |
2170 } | 2169 } |
2171 | 2170 |
2172 bool ResourceDispatcherHost::allow_cross_origin_auth_prompt() { | 2171 bool ResourceDispatcherHost::allow_cross_origin_auth_prompt() { |
2173 return allow_cross_origin_auth_prompt_; | 2172 return allow_cross_origin_auth_prompt_; |
2174 } | 2173 } |
2175 | 2174 |
2176 void ResourceDispatcherHost::set_allow_cross_origin_auth_prompt(bool value) { | 2175 void ResourceDispatcherHost::set_allow_cross_origin_auth_prompt(bool value) { |
2177 allow_cross_origin_auth_prompt_ = value; | 2176 allow_cross_origin_auth_prompt_ = value; |
2178 } | 2177 } |
OLD | NEW |