OLD | NEW |
1 // Copyright (c) 2010 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 "chrome/browser/renderer_host/resource_dispatcher_host.h" | 7 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 ResourceType::Type type, | 296 ResourceType::Type type, |
297 ResourceHandler* handler) { | 297 ResourceHandler* handler) { |
298 if (!ResourceType::IsFrame(type) || net::URLRequest::IsHandledURL(url)) | 298 if (!ResourceType::IsFrame(type) || net::URLRequest::IsHandledURL(url)) |
299 return false; | 299 return false; |
300 | 300 |
301 BrowserThread::PostTask( | 301 BrowserThread::PostTask( |
302 BrowserThread::UI, FROM_HERE, | 302 BrowserThread::UI, FROM_HERE, |
303 NewRunnableFunction( | 303 NewRunnableFunction( |
304 &ExternalProtocolHandler::LaunchUrl, url, child_id, route_id)); | 304 &ExternalProtocolHandler::LaunchUrl, url, child_id, route_id)); |
305 | 305 |
306 handler->OnResponseCompleted(request_id, URLRequestStatus( | 306 handler->OnResponseCompleted( |
307 URLRequestStatus::FAILED, | 307 request_id, |
308 net::ERR_ABORTED), | 308 net::URLRequestStatus(net::URLRequestStatus::FAILED, net::ERR_ABORTED), |
309 std::string()); // No security info necessary. | 309 std::string()); // No security info necessary. |
310 return true; | 310 return true; |
311 } | 311 } |
312 | 312 |
313 bool ResourceDispatcherHost::OnMessageReceived(const IPC::Message& message, | 313 bool ResourceDispatcherHost::OnMessageReceived(const IPC::Message& message, |
314 ResourceMessageFilter* filter, | 314 ResourceMessageFilter* filter, |
315 bool* message_was_ok) { | 315 bool* message_was_ok) { |
316 filter_ = filter; | 316 filter_ = filter; |
317 bool handled = true; | 317 bool handled = true; |
318 IPC_BEGIN_MESSAGE_MAP_EX(ResourceDispatcherHost, message, *message_was_ok) | 318 IPC_BEGIN_MESSAGE_MAP_EX(ResourceDispatcherHost, message, *message_was_ok) |
319 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestResource, OnRequestResource) | 319 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestResource, OnRequestResource) |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 CheckContextForBug68766(context); | 370 CheckContextForBug68766(context); |
371 | 371 |
372 // Might need to resolve the blob references in the upload data. | 372 // Might need to resolve the blob references in the upload data. |
373 if (request_data.upload_data && context) { | 373 if (request_data.upload_data && context) { |
374 context->blob_storage_context()->controller()-> | 374 context->blob_storage_context()->controller()-> |
375 ResolveBlobReferencesInUploadData(request_data.upload_data.get()); | 375 ResolveBlobReferencesInUploadData(request_data.upload_data.get()); |
376 } | 376 } |
377 | 377 |
378 if (is_shutdown_ || | 378 if (is_shutdown_ || |
379 !ShouldServiceRequest(process_type, child_id, request_data)) { | 379 !ShouldServiceRequest(process_type, child_id, request_data)) { |
380 URLRequestStatus status(URLRequestStatus::FAILED, net::ERR_ABORTED); | 380 net::URLRequestStatus status(net::URLRequestStatus::FAILED, |
| 381 net::ERR_ABORTED); |
381 if (sync_result) { | 382 if (sync_result) { |
382 SyncLoadResult result; | 383 SyncLoadResult result; |
383 result.status = status; | 384 result.status = status; |
384 ViewHostMsg_SyncLoad::WriteReplyParams(sync_result, result); | 385 ViewHostMsg_SyncLoad::WriteReplyParams(sync_result, result); |
385 filter_->Send(sync_result); | 386 filter_->Send(sync_result); |
386 } else { | 387 } else { |
387 // Tell the renderer that this request was disallowed. | 388 // Tell the renderer that this request was disallowed. |
388 filter_->Send(new ViewMsg_Resource_RequestComplete( | 389 filter_->Send(new ViewMsg_Resource_RequestComplete( |
389 route_id, | 390 route_id, |
390 request_id, | 391 request_id, |
(...skipping 1544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1935 return is_prefetch_enabled_; | 1936 return is_prefetch_enabled_; |
1936 } | 1937 } |
1937 | 1938 |
1938 // static | 1939 // static |
1939 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) { | 1940 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) { |
1940 is_prefetch_enabled_ = value; | 1941 is_prefetch_enabled_ = value; |
1941 } | 1942 } |
1942 | 1943 |
1943 // static | 1944 // static |
1944 bool ResourceDispatcherHost::is_prefetch_enabled_ = false; | 1945 bool ResourceDispatcherHost::is_prefetch_enabled_ = false; |
OLD | NEW |