Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Unified Diff: webkit/appcache/appcache_service.cc

Issue 6269016: Helper (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/appcache/appcache_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/appcache/appcache_service.cc
===================================================================
--- webkit/appcache/appcache_service.cc (revision 71705)
+++ webkit/appcache/appcache_service.cc (working copy)
@@ -8,6 +8,7 @@
#include "base/message_loop.h"
#include "base/stl_util-inl.h"
#include "webkit/appcache/appcache_backend_impl.h"
+#include "webkit/appcache/appcache_entry.h"
#include "webkit/appcache/appcache_storage_impl.h"
namespace appcache {
@@ -60,6 +61,43 @@
service_ = NULL;
}
+// CanHandleOfflineHelper -------
+
+class AppCacheService::CanHandleOfflineHelper : AsyncHelper {
+ public:
+ CanHandleOfflineHelper(
+ AppCacheService* service, const GURL& url,
+ 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_;
+ DISALLOW_COPY_AND_ASSIGN(CanHandleOfflineHelper);
+};
+
+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 {
@@ -82,6 +120,7 @@
appcache::AppCacheGroup* group, bool success);
GURL manifest_url_;
+ DISALLOW_COPY_AND_ASSIGN(DeleteHelper);
};
void AppCacheService::DeleteHelper::OnGroupLoaded(
@@ -121,6 +160,7 @@
virtual void OnAllInfo(AppCacheInfoCollection* collection);
scoped_refptr<AppCacheInfoCollection> collection_;
+ DISALLOW_COPY_AND_ASSIGN(GetInfoHelper);
};
void AppCacheService::GetInfoHelper::OnAllInfo(
@@ -155,6 +195,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);
« no previous file with comments | « webkit/appcache/appcache_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698