Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 23851010: Modify ResourceMessageFilter so that it can support attaching to PluginProcessHost. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/web_contents/web_contents_impl.cc
===================================================================
--- content/browser/web_contents/web_contents_impl.cc (revision 222038)
+++ content/browser/web_contents/web_contents_impl.cc (working copy)
@@ -79,6 +79,9 @@
#include "net/base/mime_util.h"
#include "net/base/net_util.h"
#include "net/base/network_change_notifier.h"
+#include "net/http/http_cache.h"
+#include "net/http/http_transaction_factory.h"
+#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_getter.h"
#include "ui/base/layout.h"
#include "ui/base/touch/touch_device.h"
@@ -265,6 +268,14 @@
delegate->AddNavigationHeaders(params->url, &params->extra_headers);
}
+void NotifyCacheOnIO(
+ scoped_refptr<net::URLRequestContextGetter> request_context,
+ const GURL& url,
+ const std::string& http_method) {
+ request_context->GetURLRequestContext()->http_transaction_factory()->
+ GetCache()->OnExternalCacheHit(url, http_method);
+}
+
} // namespace
WebContents* WebContents::Create(const WebContents::CreateParams& params) {
@@ -2289,6 +2300,19 @@
NOTIFICATION_LOAD_FROM_MEMORY_CACHE,
Source<NavigationController>(&controller_),
Details<LoadFromMemoryCacheDetails>(&details));
+
+ if (url.is_valid() && url.SchemeIsHTTPOrHTTPS()) {
+ scoped_refptr<net::URLRequestContextGetter> request_context(
+ resource_type == ResourceType::MEDIA ?
+ GetBrowserContext()->GetMediaRequestContextForRenderProcess(
+ GetRenderProcessHost()->GetID()) :
+ GetBrowserContext()->GetRequestContextForRenderProcess(
+ GetRenderProcessHost()->GetID()));
+ BrowserThread::PostTask(
+ BrowserThread::IO,
+ FROM_HERE,
+ base::Bind(&NotifyCacheOnIO, request_context, url, http_method));
+ }
}
void WebContentsImpl::OnDidDisplayInsecureContent() {
« no previous file with comments | « content/browser/renderer_host/socket_stream_dispatcher_host.cc ('k') | content/browser/worker_host/worker_process_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698