Index: webkit/appcache/appcache_service.cc |
=================================================================== |
--- webkit/appcache/appcache_service.cc (revision 71705) |
+++ webkit/appcache/appcache_service.cc (working copy) |
@@ -9,6 +9,7 @@ |
#include "base/stl_util-inl.h" |
#include "webkit/appcache/appcache_backend_impl.h" |
#include "webkit/appcache/appcache_storage_impl.h" |
+#include "webkit/appcache/appcache_entry.h" |
oshima
2011/01/23 15:24:18
sort includes
michaeln
2011/01/24 20:38:34
Done.
|
namespace appcache { |
@@ -60,6 +61,42 @@ |
service_ = NULL; |
} |
+// CanHandleOfflineHelper ------- |
+ |
+class AppCacheService::CanHandleOfflineHelper : AsyncHelper { |
+ public: |
+ CanHandleOfflineHelper( |
+ AppCacheService* service, const GURL& url, |
oshima
2011/01/23 15:24:18
looks like arguments can move to above?
michaeln
2011/01/24 20:38:34
The 'callback' param won't fit. In keeping with ho
|
+ net::CompletionCallback* callback) |
+ : AsyncHelper(service, callback), url_(url) { |
+ } |
+ |
+ virtual void Start() { |
+ service_->storage()->FindResponseForMainRequest(url_, this); |
+ } |
+ |
+ private: |
+ // AppCacheStorage::Delegate override |
+ virtual void OnMainResponseFound( |
+ const GURL& url, const AppCacheEntry& entry, |
+ const GURL& fallback_url, const AppCacheEntry& fallback_entry, |
+ int64 cache_id, const GURL& mainfest_url, |
+ bool was_blocked_by_policy); |
+ |
+ GURL url_; |
oshima
2011/01/23 15:24:18
DISALLOW_COPY_AND_ASSIGN
michaeln
2011/01/24 20:38:34
Done (here and in other helpers)
|
+}; |
+ |
+void AppCacheService::CanHandleOfflineHelper::OnMainResponseFound( |
+ const GURL& url, const AppCacheEntry& entry, |
+ const GURL& fallback_url, const AppCacheEntry& fallback_entry, |
+ int64 cache_id, const GURL& mainfest_url, |
+ bool was_blocked_by_policy) { |
+ bool can = !was_blocked_by_policy && |
+ (entry.has_response_id() || fallback_entry.has_response_id()); |
+ CallCallback(can ? net::OK : net::ERR_FAILED); |
+ delete this; |
+} |
+ |
// DeleteHelper ------- |
class AppCacheService::DeleteHelper : public AsyncHelper { |
@@ -155,6 +192,14 @@ |
storage_.reset(storage); |
} |
+void AppCacheService::CanHandleMainResourceOffline( |
+ const GURL& url, |
+ net::CompletionCallback* callback) { |
+ CanHandleOfflineHelper* helper = |
+ new CanHandleOfflineHelper(this, url, callback); |
+ helper->Start(); |
+} |
+ |
void AppCacheService::GetAllAppCacheInfo(AppCacheInfoCollection* collection, |
net::CompletionCallback* callback) { |
DCHECK(collection); |