summaryrefslogtreecommitdiffstats
path: root/webkit/appcache/appcache_storage_impl.cc
diff options
context:
space:
mode:
authormichaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-05 23:40:02 +0000
committermichaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-05 23:40:02 +0000
commitd68a4fc6f448c6ebf407e2817320e7736c4735ee (patch)
treed76e2c91aa67af5a880ec81eddcbf2d12887e865 /webkit/appcache/appcache_storage_impl.cc
parent63eb6c0bebc31046bbd954ef21dee86dca9d7fe3 (diff)
downloadchromium_src-d68a4fc6f448c6ebf407e2817320e7736c4735ee.zip
chromium_src-d68a4fc6f448c6ebf407e2817320e7736c4735ee.tar.gz
chromium_src-d68a4fc6f448c6ebf407e2817320e7736c4735ee.tar.bz2
Hook up the content settings UI to the appcache.
* Populate the tree view with appcaches * Delete selected appcaches from the tree view * Delete the date range indicated in the browsing data remover TEST=manual BUG=34634 Review URL: http://codereview.chromium.org/660423 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40796 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache/appcache_storage_impl.cc')
-rw-r--r--webkit/appcache/appcache_storage_impl.cc61
1 files changed, 61 insertions, 0 deletions
diff --git a/webkit/appcache/appcache_storage_impl.cc b/webkit/appcache/appcache_storage_impl.cc
index 6fd5486..54afc9a 100644
--- a/webkit/appcache/appcache_storage_impl.cc
+++ b/webkit/appcache/appcache_storage_impl.cc
@@ -183,6 +183,49 @@ class AppCacheStorageImpl::DisableDatabaseTask : public DatabaseTask {
virtual void Run() { database_->Disable(); }
};
+// GetAllInfoTask -------
+
+class AppCacheStorageImpl::GetAllInfoTask : public DatabaseTask {
+ public:
+ explicit GetAllInfoTask(AppCacheStorageImpl* storage)
+ : DatabaseTask(storage),
+ info_collection_(new AppCacheInfoCollection()) {
+ }
+
+ virtual void Run();
+ virtual void RunCompleted();
+
+ scoped_refptr<AppCacheInfoCollection> info_collection_;
+};
+
+void AppCacheStorageImpl::GetAllInfoTask::Run() {
+ std::set<GURL> origins;
+ database_->FindOriginsWithGroups(&origins);
+ for (std::set<GURL>::const_iterator origin = origins.begin();
+ origin != origins.end(); ++origin) {
+ AppCacheInfoVector& infos =
+ info_collection_->infos_by_origin[*origin];
+ std::vector<AppCacheDatabase::GroupRecord> groups;
+ database_->FindGroupsForOrigin(*origin, &groups);
+ for (std::vector<AppCacheDatabase::GroupRecord>::const_iterator
+ group = groups.begin();
+ group != groups.end(); ++group) {
+ AppCacheDatabase::CacheRecord cache_record;
+ database_->FindCacheForGroup(group->group_id, &cache_record);
+ infos.push_back(
+ AppCacheInfo(
+ group->manifest_url, cache_record.cache_size,
+ group->creation_time, group->last_access_time,
+ cache_record.update_time));
+ }
+ }
+}
+
+void AppCacheStorageImpl::GetAllInfoTask::RunCompleted() {
+ DCHECK(delegates_.size() == 1);
+ FOR_EACH_DELEGATE(delegates_, OnAllInfo(info_collection_));
+}
+
// StoreOrLoadTask -------
class AppCacheStorageImpl::StoreOrLoadTask : public DatabaseTask {
@@ -812,6 +855,13 @@ void AppCacheStorageImpl::Disable() {
task->Schedule();
}
+void AppCacheStorageImpl::GetAllInfo(Delegate* delegate) {
+ DCHECK(delegate);
+ scoped_refptr<GetAllInfoTask> task = new GetAllInfoTask(this);
+ task->AddDelegate(GetOrCreateDelegateReference(delegate));
+ task->Schedule();
+}
+
void AppCacheStorageImpl::LoadCache(int64 id, Delegate* delegate) {
DCHECK(delegate);
if (is_disabled_) {
@@ -993,6 +1043,17 @@ void AppCacheStorageImpl::FindResponseForSubRequest(
AppCacheEntry* found_entry, AppCacheEntry* found_fallback_entry,
bool* found_network_namespace) {
DCHECK(cache && cache->is_complete());
+
+ // When a group is forcibly deleted, all subresource loads for pages
+ // using caches in the group will result in a synthesized network errors.
+ // Forcible deletion is not a function that is covered by the HTML5 spec.
+ if (cache->owning_group()->is_being_deleted()) {
+ *found_entry = AppCacheEntry();
+ *found_fallback_entry = AppCacheEntry();
+ *found_network_namespace = false;
+ return;
+ }
+
GURL fallback_namespace_not_used;
cache->FindResponseForRequest(
url, found_entry, found_fallback_entry,