summaryrefslogtreecommitdiffstats
path: root/webkit/appcache/appcache_request_handler.cc
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.cc
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.cc')
-rw-r--r--webkit/appcache/appcache_request_handler.cc63
1 files changed, 63 insertions, 0 deletions
diff --git a/webkit/appcache/appcache_request_handler.cc b/webkit/appcache/appcache_request_handler.cc
new file mode 100644
index 0000000..322e8bc
--- /dev/null
+++ b/webkit/appcache/appcache_request_handler.cc
@@ -0,0 +1,63 @@
+// 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.
+
+#include "webkit/appcache/appcache_request_handler.h"
+
+#include "net/url_request/url_request.h"
+#include "net/url_request/url_request_job.h"
+#include "webkit/appcache/appcache.h"
+
+namespace appcache {
+
+// AppCacheRequestHandler -----------------------------------------------------
+
+static bool IsHttpOrHttpsGetOrEquivalent(URLRequest* request) {
+ return false; // TODO(michaeln): write me
+}
+
+AppCacheRequestHandler::AppCacheRequestHandler(AppCacheHost* host)
+ : is_main_request_(true), cache_id_(kNoCacheId),
+ host_(host->AsWeakPtr()), service_(host->service()) {
+}
+
+AppCacheRequestHandler::AppCacheRequestHandler(AppCache* cache)
+ : is_main_request_(false), cache_id_(kNoCacheId),
+ cache_(cache), service_(cache->service()) {
+}
+
+void AppCacheRequestHandler::GetExtraResponseInfo(
+ int64* cache_id, GURL* manifest_url) {
+ // TODO(michaeln): If this is a main request and it was retrieved from
+ // an appcache, ensure that appcache survives the frame navigation. The
+ // AppCacheHost should hold reference to that cache to prevent it from
+ // being dropped from the in-memory collection of AppCaches. When cache
+ // selection occurs, that extra reference should be dropped. Perhaps
+ // maybe: if (is_main) host->LoadCacheOfMainResource(cache_id);
+}
+
+URLRequestJob* AppCacheRequestHandler::MaybeLoadResource(URLRequest* request) {
+ if (!IsHttpOrHttpsGetOrEquivalent(request))
+ return NULL;
+ // TODO(michaeln): write me
+ return NULL;
+}
+
+URLRequestJob* AppCacheRequestHandler::MaybeLoadFallbackForRedirect(
+ URLRequest* request, const GURL& location) {
+ if (!IsHttpOrHttpsGetOrEquivalent(request))
+ return NULL;
+ // TODO(michaeln): write me
+ return NULL;
+}
+
+URLRequestJob* AppCacheRequestHandler::MaybeLoadFallbackForResponse(
+ URLRequest* request) {
+ if (!IsHttpOrHttpsGetOrEquivalent(request))
+ return NULL;
+ // TODO(michaeln): write me
+ return NULL;
+}
+
+} // namespace appcache
+