Chromium Code Reviews| Index: content/browser/renderer_host/resource_dispatcher_host.cc |
| diff --git a/content/browser/renderer_host/resource_dispatcher_host.cc b/content/browser/renderer_host/resource_dispatcher_host.cc |
| index 0b78183547b3aaf56fdaeba238350cee743a8188..f0d933bdbec50cbf021bb993f8347cd8bf34a00a 100644 |
| --- a/content/browser/renderer_host/resource_dispatcher_host.cc |
| +++ b/content/browser/renderer_host/resource_dispatcher_host.cc |
| @@ -68,7 +68,9 @@ |
| #include "net/base/request_priority.h" |
| #include "net/base/ssl_cert_request_info.h" |
| #include "net/base/upload_data.h" |
| +#include "net/http/http_cache.h" |
| #include "net/http/http_response_headers.h" |
| +#include "net/http/http_transaction_factory.h" |
| #include "net/url_request/url_request.h" |
| #include "net/url_request/url_request_context.h" |
| #include "net/url_request/url_request_job_factory.h" |
| @@ -338,9 +340,17 @@ bool ResourceDispatcherHost::OnMessageReceived(const IPC::Message& message, |
| IPC_MESSAGE_HANDLER(ResourceHostMsg_CancelRequest, OnCancelRequest) |
| IPC_MESSAGE_HANDLER(ResourceHostMsg_FollowRedirect, OnFollowRedirect) |
| IPC_MESSAGE_HANDLER(ViewHostMsg_SwapOut_ACK, OnSwapOutACK) |
| + IPC_MESSAGE_HANDLER(ViewHostMsg_DidLoadResourceFromMemoryCache, |
| + OnDidLoadResourceFromMemoryCache) |
| IPC_MESSAGE_UNHANDLED(handled = false) |
| IPC_END_MESSAGE_MAP_EX() |
| + if (message.type() == ViewHostMsg_DidLoadResourceFromMemoryCache::ID) { |
| + // We just needed to peek at this message. We still want it to reach its |
| + // normal destination. |
| + handled = false; |
| + } |
| + |
| filter_ = NULL; |
| return handled; |
| } |
| @@ -675,6 +685,18 @@ void ResourceDispatcherHost::OnSwapOutACK( |
| &RenderViewHost::OnSwapOutACK); |
| } |
| +void ResourceDispatcherHost::OnDidLoadResourceFromMemoryCache( |
| + const GURL& url, |
| + const std::string& security_info, |
| + const std::string& http_method, |
| + ResourceType::Type resource_type) { |
| + 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
|
| + return; |
| + |
| + filter_->GetURLRequestContext(resource_type)->http_transaction_factory()-> |
| + GetCache()->OnExternalCacheHit(url, http_method); |
| +} |
| + |
| // We are explicitly forcing the download of 'url'. |
| void ResourceDispatcherHost::BeginDownload( |
| const GURL& url, |