summaryrefslogtreecommitdiffstats
path: root/chrome/browser/renderer_host
diff options
context:
space:
mode:
authormichaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-01 22:30:30 +0000
committermichaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-01 22:30:30 +0000
commit23f1ef1a445a53bcefc8ddab9f4184b1db7321c5 (patch)
treec9f17a33025ed5b5c5dee76a7b4fef9104e9a995 /chrome/browser/renderer_host
parente143c823ce66af5a83a9a17b6f5938eb16e49392 (diff)
downloadchromium_src-23f1ef1a445a53bcefc8ddab9f4184b1db7321c5.zip
chromium_src-23f1ef1a445a53bcefc8ddab9f4184b1db7321c5.tar.gz
chromium_src-23f1ef1a445a53bcefc8ddab9f4184b1db7321c5.tar.bz2
Plumb request interception into the appcache library for both chrome and test_shell.
AppCache library: * Added AppCacheInterceptor, which is derived from URLRequest::Interceptor. Chrome: * Each UserProfile instantiates a ChromeAppCacheService, which is derived from an appcache library class. * Each ChromeURLRequestContext associated with that profile has a reference to that instance. * ResourceDispatcherHost pokes AppCacheInterceptor when initiating URLRequests and when returning the response head. TestShell: * Added SimpleAppCacheSystem which bundles together appcache lib components for use in a single process with an UI and IO thread. * TestShellWebKit instantiates and initializes an instance of the above, aimed at at temp directory that will get cleaned up when the test run is over. * SimpleResourceLoaderBridge pokes the system when initiating URLRequests and when returning the response head. TEST=none, although many existing tests exercise this stuff BUG=none Review URL: http://codereview.chromium.org/173406 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25099 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/renderer_host')
-rw-r--r--chrome/browser/renderer_host/resource_dispatcher_host.cc15
-rw-r--r--chrome/browser/renderer_host/resource_message_filter.cc5
2 files changed, 16 insertions, 4 deletions
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.cc b/chrome/browser/renderer_host/resource_dispatcher_host.cc
index 7d42929..669118b 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host.cc
+++ b/chrome/browser/renderer_host/resource_dispatcher_host.cc
@@ -54,6 +54,7 @@
#include "net/base/ssl_cert_request_info.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_context.h"
+#include "webkit/appcache/appcache_interceptor.h"
#include "webkit/appcache/appcache_interfaces.h"
// TODO(port): Move these includes to the above section when porting is done.
@@ -239,9 +240,11 @@ void PopulateResourceResponse(URLRequest* request,
request->GetCharset(&response->response_head.charset);
response->response_head.filter_policy = filter_policy;
response->response_head.content_length = request->GetExpectedContentSize();
- response->response_head.appcache_id = appcache::kNoCacheId;
- response->response_head.appcache_manifest_url = GURL();
request->GetMimeType(&response->response_head.mime_type);
+ appcache::AppCacheInterceptor::GetExtraResponseInfo(
+ request,
+ &response->response_head.appcache_id,
+ &response->response_head.appcache_manifest_url);
}
} // namespace
@@ -294,6 +297,9 @@ void ResourceDispatcherHost::Initialize() {
DCHECK(MessageLoop::current() == ui_loop_);
download_file_manager_->Initialize();
safe_browsing_->Initialize(io_loop_);
+ io_loop_->PostTask(
+ FROM_HERE,
+ NewRunnableFunction(&appcache::AppCacheInterceptor::EnsureRegistered));
}
void ResourceDispatcherHost::Shutdown() {
@@ -582,6 +588,11 @@ void ResourceDispatcherHost::BeginRequest(
chrome_browser_net::SetOriginProcessUniqueIDForRequest(
request_data.origin_child_id, request);
+ // Have the appcache associate its extra info with the request.
+ appcache::AppCacheInterceptor::SetExtraRequestInfo(
+ request, context ? context->appcache_service() : NULL, child_id,
+ request_data.appcache_host_id, request_data.resource_type);
+
BeginRequestInternal(request);
}
diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc
index 61debd5..b211f67 100644
--- a/chrome/browser/renderer_host/resource_message_filter.cc
+++ b/chrome/browser/renderer_host/resource_message_filter.cc
@@ -156,7 +156,8 @@ ResourceMessageFilter::ResourceMessageFilter(
profile_(profile),
render_widget_helper_(render_widget_helper),
audio_renderer_host_(audio_renderer_host),
- appcache_dispatcher_host_(new AppCacheDispatcherHost),
+ appcache_dispatcher_host_(
+ new AppCacheDispatcherHost(profile->GetAppCacheService())),
ALLOW_THIS_IN_INITIALIZER_LIST(dom_storage_dispatcher_host_(
new DOMStorageDispatcherHost(this, profile->GetWebKitContext(),
resource_dispatcher_host->webkit_thread()))),
@@ -193,7 +194,7 @@ ResourceMessageFilter::~ResourceMessageFilter() {
void ResourceMessageFilter::Init() {
render_widget_helper_->Init(id(), resource_dispatcher_host_);
- appcache_dispatcher_host_->Initialize(this);
+ appcache_dispatcher_host_->Initialize(this, id());
}
// Called on the IPC thread: