summaryrefslogtreecommitdiffstats
path: root/webkit/appcache/appcache_request_handler.h
diff options
context:
space:
mode:
authormichaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-15 22:07:15 +0000
committermichaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-15 22:07:15 +0000
commit97e3edc23314c476859c22c8db601f9b3dec552d (patch)
tree9c589f47545b88c1453c2481a7844a921636485c /webkit/appcache/appcache_request_handler.h
parent34fce2a5030cb53a1e2decb37b5f7517f98457f7 (diff)
downloadchromium_src-97e3edc23314c476859c22c8db601f9b3dec552d.zip
chromium_src-97e3edc23314c476859c22c8db601f9b3dec552d.tar.gz
chromium_src-97e3edc23314c476859c22c8db601f9b3dec552d.tar.bz2
* Fleshed out AppCacheHost class a fair amount, in particular the cache selection algorithm.
* Added some AppCacheHost unit tests. * Introduced AppCacheRequestHandler class, which replaces the clunkyApp CacheInterceptor::ExtraInfo struct. This impl is entirely skeletal stubs for now. TEST=appcache_unittest.cc, but really needs more BUG=none Review URL: http://codereview.chromium.org/192043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26275 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache/appcache_request_handler.h')
-rw-r--r--webkit/appcache/appcache_request_handler.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/webkit/appcache/appcache_request_handler.h b/webkit/appcache/appcache_request_handler.h
new file mode 100644
index 0000000..78fe9c3
--- /dev/null
+++ b/webkit/appcache/appcache_request_handler.h
@@ -0,0 +1,53 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_APPCACHE_APPCACHE_REQUEST_HANDLER_H_
+#define WEBKIT_APPCACHE_APPCACHE_REQUEST_HANDLER_H_
+
+#include "net/url_request/url_request.h"
+#include "webkit/appcache/appcache_host.h"
+
+class URLRequest;
+class URLRequestJob;
+
+namespace appcache {
+
+// An instance is created for each URLRequest. The instance survives all
+// http transactions involved in the processing of its URLRequest, and is
+// given the opportunity to hijack the request along the way. Callers
+// should use AppCacheHost::CreateRequestHandler to manufacture instances
+// that can retrieve resources for a particular host.
+class AppCacheRequestHandler : public URLRequest::UserData {
+ public:
+ // Should be called on each request intercept opportunity.
+ URLRequestJob* MaybeLoadResource(URLRequest* request);
+ URLRequestJob* MaybeLoadFallbackForRedirect(URLRequest* request,
+ const GURL& location);
+ URLRequestJob* MaybeLoadFallbackForResponse(URLRequest* request);
+
+ void GetExtraResponseInfo(int64* cache_id, GURL* manifest_url);
+
+ private:
+ friend class AppCacheHost;
+
+ // Ctor for main resource loads.
+ explicit AppCacheRequestHandler(AppCacheHost* host);
+
+ // Ctor for subresource loads when the cache is loaded.
+ explicit AppCacheRequestHandler(AppCache* cache);
+
+ // Main vs subresource loads are very different.
+ // TODO(michaeln): maybe have two derived classes?
+ bool is_main_request_;
+ int64 cache_id_;
+ scoped_refptr<AppCache> cache_;
+ base::WeakPtr<AppCacheHost> host_;
+ scoped_refptr<URLRequestJob> job_;
+ AppCacheService* service_;
+};
+
+} // namespace appcache
+
+#endif // WEBKIT_APPCACHE_APPCACHE_REQUEST_HANDLER_H_
+