OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/browser/renderer_host/resource_dispatcher_host.h" | 7 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 int route_id) { | 267 int route_id) { |
268 ChildProcessInfo::ProcessType process_type = receiver_->type(); | 268 ChildProcessInfo::ProcessType process_type = receiver_->type(); |
269 int process_id = receiver_->GetProcessId(); | 269 int process_id = receiver_->GetProcessId(); |
270 URLRequestContext* context = | 270 URLRequestContext* context = |
271 receiver_->GetRequestContext(request_id, request_data); | 271 receiver_->GetRequestContext(request_id, request_data); |
272 if (!context) | 272 if (!context) |
273 context = Profile::GetDefaultRequestContext(); | 273 context = Profile::GetDefaultRequestContext(); |
274 | 274 |
275 if (is_shutdown_ || | 275 if (is_shutdown_ || |
276 !ShouldServiceRequest(process_type, process_id, request_data)) { | 276 !ShouldServiceRequest(process_type, process_id, request_data)) { |
277 // Tell the renderer that this request was disallowed. | 277 URLRequestStatus status(URLRequestStatus::FAILED, net::ERR_ABORTED); |
278 receiver_->Send(new ViewMsg_Resource_RequestComplete( | 278 if (sync_result) { |
279 route_id, | 279 SyncLoadResult result; |
280 request_id, | 280 result.status = status; |
281 URLRequestStatus(URLRequestStatus::FAILED, net::ERR_ABORTED), | 281 ViewHostMsg_SyncLoad::WriteReplyParams(sync_result, result); |
282 std::string())); // No security info needed, connection was not | 282 receiver_->Send(sync_result); |
283 // established. | 283 } else { |
| 284 // Tell the renderer that this request was disallowed. |
| 285 receiver_->Send(new ViewMsg_Resource_RequestComplete( |
| 286 route_id, |
| 287 request_id, |
| 288 status, |
| 289 std::string())); // No security info needed, connection was not |
| 290 // established. |
| 291 } |
284 return; | 292 return; |
285 } | 293 } |
286 | 294 |
287 // Ensure the Chrome plugins are loaded, as they may intercept network | 295 // Ensure the Chrome plugins are loaded, as they may intercept network |
288 // requests. Does nothing if they are already loaded. | 296 // requests. Does nothing if they are already loaded. |
289 // TODO(mpcomplete): This takes 200 ms! Investigate parallelizing this by | 297 // TODO(mpcomplete): This takes 200 ms! Investigate parallelizing this by |
290 // starting the load earlier in a BG thread. | 298 // starting the load earlier in a BG thread. |
291 plugin_service_->LoadChromePlugins(this); | 299 plugin_service_->LoadChromePlugins(this); |
292 | 300 |
293 // Construct the event handler. | 301 // Construct the event handler. |
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1540 case ViewHostMsg_UploadProgress_ACK::ID: | 1548 case ViewHostMsg_UploadProgress_ACK::ID: |
1541 case ViewHostMsg_SyncLoad::ID: | 1549 case ViewHostMsg_SyncLoad::ID: |
1542 return true; | 1550 return true; |
1543 | 1551 |
1544 default: | 1552 default: |
1545 break; | 1553 break; |
1546 } | 1554 } |
1547 | 1555 |
1548 return false; | 1556 return false; |
1549 } | 1557 } |
OLD | NEW |