Chromium Code Reviews| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 #include "net/base/auth.h" | 61 #include "net/base/auth.h" |
| 62 #include "net/base/cert_status_flags.h" | 62 #include "net/base/cert_status_flags.h" |
| 63 #include "net/base/cookie_monster.h" | 63 #include "net/base/cookie_monster.h" |
| 64 #include "net/base/load_flags.h" | 64 #include "net/base/load_flags.h" |
| 65 #include "net/base/mime_util.h" | 65 #include "net/base/mime_util.h" |
| 66 #include "net/base/net_errors.h" | 66 #include "net/base/net_errors.h" |
| 67 #include "net/base/registry_controlled_domain.h" | 67 #include "net/base/registry_controlled_domain.h" |
| 68 #include "net/base/request_priority.h" | 68 #include "net/base/request_priority.h" |
| 69 #include "net/base/ssl_cert_request_info.h" | 69 #include "net/base/ssl_cert_request_info.h" |
| 70 #include "net/base/upload_data.h" | 70 #include "net/base/upload_data.h" |
| 71 #include "net/http/http_cache.h" | |
| 71 #include "net/http/http_response_headers.h" | 72 #include "net/http/http_response_headers.h" |
| 73 #include "net/http/http_transaction_factory.h" | |
| 72 #include "net/url_request/url_request.h" | 74 #include "net/url_request/url_request.h" |
| 73 #include "net/url_request/url_request_context.h" | 75 #include "net/url_request/url_request_context.h" |
| 74 #include "net/url_request/url_request_job_factory.h" | 76 #include "net/url_request/url_request_job_factory.h" |
| 75 #include "webkit/appcache/appcache_interceptor.h" | 77 #include "webkit/appcache/appcache_interceptor.h" |
| 76 #include "webkit/appcache/appcache_interfaces.h" | 78 #include "webkit/appcache/appcache_interfaces.h" |
| 77 #include "webkit/blob/blob_storage_controller.h" | 79 #include "webkit/blob/blob_storage_controller.h" |
| 78 #include "webkit/blob/deletable_file_reference.h" | 80 #include "webkit/blob/deletable_file_reference.h" |
| 79 | 81 |
| 80 using base::Time; | 82 using base::Time; |
| 81 using base::TimeDelta; | 83 using base::TimeDelta; |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 331 IPC_MESSAGE_HANDLER(ResourceHostMsg_RequestResource, OnRequestResource) | 333 IPC_MESSAGE_HANDLER(ResourceHostMsg_RequestResource, OnRequestResource) |
| 332 IPC_MESSAGE_HANDLER_DELAY_REPLY(ResourceHostMsg_SyncLoad, OnSyncLoad) | 334 IPC_MESSAGE_HANDLER_DELAY_REPLY(ResourceHostMsg_SyncLoad, OnSyncLoad) |
| 333 IPC_MESSAGE_HANDLER(ResourceHostMsg_ReleaseDownloadedFile, | 335 IPC_MESSAGE_HANDLER(ResourceHostMsg_ReleaseDownloadedFile, |
| 334 OnReleaseDownloadedFile) | 336 OnReleaseDownloadedFile) |
| 335 IPC_MESSAGE_HANDLER(ResourceHostMsg_DataReceived_ACK, OnDataReceivedACK) | 337 IPC_MESSAGE_HANDLER(ResourceHostMsg_DataReceived_ACK, OnDataReceivedACK) |
| 336 IPC_MESSAGE_HANDLER(ResourceHostMsg_DataDownloaded_ACK, OnDataDownloadedACK) | 338 IPC_MESSAGE_HANDLER(ResourceHostMsg_DataDownloaded_ACK, OnDataDownloadedACK) |
| 337 IPC_MESSAGE_HANDLER(ResourceHostMsg_UploadProgress_ACK, OnUploadProgressACK) | 339 IPC_MESSAGE_HANDLER(ResourceHostMsg_UploadProgress_ACK, OnUploadProgressACK) |
| 338 IPC_MESSAGE_HANDLER(ResourceHostMsg_CancelRequest, OnCancelRequest) | 340 IPC_MESSAGE_HANDLER(ResourceHostMsg_CancelRequest, OnCancelRequest) |
| 339 IPC_MESSAGE_HANDLER(ResourceHostMsg_FollowRedirect, OnFollowRedirect) | 341 IPC_MESSAGE_HANDLER(ResourceHostMsg_FollowRedirect, OnFollowRedirect) |
| 340 IPC_MESSAGE_HANDLER(ViewHostMsg_SwapOut_ACK, OnSwapOutACK) | 342 IPC_MESSAGE_HANDLER(ViewHostMsg_SwapOut_ACK, OnSwapOutACK) |
| 343 IPC_MESSAGE_HANDLER(ViewHostMsg_DidLoadResourceFromMemoryCache, | |
| 344 OnDidLoadResourceFromMemoryCache) | |
| 341 IPC_MESSAGE_UNHANDLED(handled = false) | 345 IPC_MESSAGE_UNHANDLED(handled = false) |
| 342 IPC_END_MESSAGE_MAP_EX() | 346 IPC_END_MESSAGE_MAP_EX() |
| 343 | 347 |
| 348 if (message.type() == ViewHostMsg_DidLoadResourceFromMemoryCache::ID) { | |
| 349 // We just needed to peek at this message. We still want it to reach its | |
| 350 // normal destination. | |
| 351 handled = false; | |
| 352 } | |
| 353 | |
| 344 filter_ = NULL; | 354 filter_ = NULL; |
| 345 return handled; | 355 return handled; |
| 346 } | 356 } |
| 347 | 357 |
| 348 void ResourceDispatcherHost::OnRequestResource( | 358 void ResourceDispatcherHost::OnRequestResource( |
| 349 const IPC::Message& message, | 359 const IPC::Message& message, |
| 350 int request_id, | 360 int request_id, |
| 351 const ResourceHostMsg_Request& request_data) { | 361 const ResourceHostMsg_Request& request_data) { |
| 352 BeginRequest(request_id, request_data, NULL, message.routing_id()); | 362 BeginRequest(request_id, request_data, NULL, message.routing_id()); |
| 353 } | 363 } |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 668 ResourceDispatcherHostRequestInfo* info = InfoForRequest(i->second); | 678 ResourceDispatcherHostRequestInfo* info = InfoForRequest(i->second); |
| 669 if (info->cross_site_handler()) | 679 if (info->cross_site_handler()) |
| 670 info->cross_site_handler()->ResumeResponse(); | 680 info->cross_site_handler()->ResumeResponse(); |
| 671 } | 681 } |
| 672 // Update the RenderViewHost's internal state after the ACK. | 682 // Update the RenderViewHost's internal state after the ACK. |
| 673 CallRenderViewHost(params.closing_process_id, | 683 CallRenderViewHost(params.closing_process_id, |
| 674 params.closing_route_id, | 684 params.closing_route_id, |
| 675 &RenderViewHost::OnSwapOutACK); | 685 &RenderViewHost::OnSwapOutACK); |
| 676 } | 686 } |
| 677 | 687 |
| 688 void ResourceDispatcherHost::OnDidLoadResourceFromMemoryCache( | |
| 689 const GURL& url, | |
| 690 const std::string& security_info, | |
| 691 const std::string& http_method, | |
| 692 ResourceType::Type resource_type) { | |
| 693 if (!url.is_valid() || !(url.SchemeIs("http") || url.SchemeIs("https"))) | |
|
James Simonsen
2011/08/02 00:14:28
I had to add this check, because WebKit was sendin
| |
| 694 return; | |
| 695 | |
| 696 filter_->GetURLRequestContext(resource_type)->http_transaction_factory()-> | |
| 697 GetCache()->OnExternalCacheHit(url, http_method); | |
| 698 } | |
| 699 | |
| 678 // We are explicitly forcing the download of 'url'. | 700 // We are explicitly forcing the download of 'url'. |
| 679 void ResourceDispatcherHost::BeginDownload( | 701 void ResourceDispatcherHost::BeginDownload( |
| 680 const GURL& url, | 702 const GURL& url, |
| 681 const GURL& referrer, | 703 const GURL& referrer, |
| 682 const DownloadSaveInfo& save_info, | 704 const DownloadSaveInfo& save_info, |
| 683 bool prompt_for_save_location, | 705 bool prompt_for_save_location, |
| 684 int child_id, | 706 int child_id, |
| 685 int route_id, | 707 int route_id, |
| 686 const content::ResourceContext& context) { | 708 const content::ResourceContext& context) { |
| 687 if (is_shutdown_) | 709 if (is_shutdown_) |
| (...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2083 return HTTP_AUTH_RESOURCE_BLOCKED_CROSS; | 2105 return HTTP_AUTH_RESOURCE_BLOCKED_CROSS; |
| 2084 } | 2106 } |
| 2085 | 2107 |
| 2086 bool ResourceDispatcherHost::allow_cross_origin_auth_prompt() { | 2108 bool ResourceDispatcherHost::allow_cross_origin_auth_prompt() { |
| 2087 return allow_cross_origin_auth_prompt_; | 2109 return allow_cross_origin_auth_prompt_; |
| 2088 } | 2110 } |
| 2089 | 2111 |
| 2090 void ResourceDispatcherHost::set_allow_cross_origin_auth_prompt(bool value) { | 2112 void ResourceDispatcherHost::set_allow_cross_origin_auth_prompt(bool value) { |
| 2091 allow_cross_origin_auth_prompt_ = value; | 2113 allow_cross_origin_auth_prompt_ = value; |
| 2092 } | 2114 } |
| OLD | NEW |