summaryrefslogtreecommitdiffstats
path: root/webkit/appcache/appcache_host.h
diff options
context:
space:
mode:
authormichaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-18 01:05:09 +0000
committermichaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-18 01:05:09 +0000
commit7e8e3dd7b1633874650f8de9a818aca8cb594f5b (patch)
tree5a973e64a1b5ca1a243744e2a9aa4a336a699985 /webkit/appcache/appcache_host.h
parent8b2034f851b1b41c2ec6539c057b63c92ef7289c (diff)
downloadchromium_src-7e8e3dd7b1633874650f8de9a818aca8cb594f5b.zip
chromium_src-7e8e3dd7b1633874650f8de9a818aca8cb594f5b.tar.gz
chromium_src-7e8e3dd7b1633874650f8de9a818aca8cb594f5b.tar.bz2
Check for supported schemes and examine request methods at key points. We support http, https, and file (dbg only) URLs for now.
* Added IsSchemeSupported, IsMethodSupported and IsMethodAndSchemeSupported helpers, and string constants. * Check for supported schemes and methods during cache selection and during request interception. Must be GET for cache selectino, GET or HEAD for request interception. * Renamed some data members in WebApplicationCacheHostImpl to more closely match naming elsewhere. * Added AppCacheHost::Observer to make life easier. (I like the observer model, and even noticed that the chrome code base has a multi-threaded version too (ala Gears)... nice :) * Switched to using the observer model in AppCacheRequestDispatcher instead of a WeakPtr. One of the observable methods is OnDestructionImminent(host). * Added gyp dependency on the net library BUG=none TEST=none Review URL: http://codereview.chromium.org/205017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26537 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache/appcache_host.h')
-rw-r--r--webkit/appcache/appcache_host.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/webkit/appcache/appcache_host.h b/webkit/appcache/appcache_host.h
index d8ee843..9b7db30 100644
--- a/webkit/appcache/appcache_host.h
+++ b/webkit/appcache/appcache_host.h
@@ -5,6 +5,7 @@
#ifndef WEBKIT_APPCACHE_APPCACHE_HOST_H_
#define WEBKIT_APPCACHE_APPCACHE_HOST_H_
+#include "base/observer_list.h"
#include "base/ref_counted.h"
#include "base/task.h"
#include "base/weak_ptr.h"
@@ -31,10 +32,27 @@ typedef Callback2<bool, void*>::Type SwapCacheCallback;
class AppCacheHost : public base::SupportsWeakPtr<AppCacheHost>,
public AppCacheService::LoadClient {
public:
+
+ class Observer {
+ public:
+ // Called just after the cache selection algorithm completes.
+ virtual void OnCacheSelectionComplete(AppCacheHost* host) = 0;
+
+ // Called just prior to the instance being deleted.
+ virtual void OnDestructionImminent(AppCacheHost* host) = 0;
+
+ virtual ~Observer() {}
+ };
+
AppCacheHost(int host_id, AppCacheFrontend* frontend,
AppCacheService* service);
~AppCacheHost();
+ // Adds/removes an observer, the AppCacheHost does not take
+ // ownership of the observer.
+ void AddObserver(Observer* observer);
+ void RemoveObserver(Observer* observer);
+
// Support for cache selection and scriptable method calls.
void SelectCache(const GURL& document_url,
const int64 cache_document_was_loaded_from,
@@ -118,6 +136,9 @@ class AppCacheHost : public base::SupportsWeakPtr<AppCacheHost>,
SwapCacheCallback* pending_swap_cache_callback_;
void* pending_callback_param_;
+ // List of objects observing us.
+ ObserverList<Observer> observers_;
+
FRIEND_TEST(AppCacheTest, CleanupUnusedCache);
FRIEND_TEST(AppCacheGroupTest, CleanupUnusedGroup);
FRIEND_TEST(AppCacheHostTest, Basic);