summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browsing_data_appcache_helper.cc
diff options
context:
space:
mode:
authormichaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-26 23:45:35 +0000
committermichaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-26 23:45:35 +0000
commitf26795ebb86f6bcd4da9d4971e252eea933cfdf3 (patch)
treef8ff18dade9b45f6d5924d03d488bcfeb518cf1c /chrome/browser/browsing_data_appcache_helper.cc
parentea4929e2226a1a83becb9ea6e4b3fb0c29b11c0e (diff)
downloadchromium_src-f26795ebb86f6bcd4da9d4971e252eea933cfdf3.zip
chromium_src-f26795ebb86f6bcd4da9d4971e252eea933cfdf3.tar.gz
chromium_src-f26795ebb86f6bcd4da9d4971e252eea933cfdf3.tar.bz2
Teach the cookie tree view and model about appcaches. Not hooked up to real data yet, but the view and model pieces are in place for windows and gtk (not yet done for the mac).
Also adds a 'name' attribute to database details pane, cleans up the layout of the detail panes on windows. BUG=25977 TEST=manual Review URL: http://codereview.chromium.org/650110 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40181 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browsing_data_appcache_helper.cc')
-rw-r--r--chrome/browser/browsing_data_appcache_helper.cc68
1 files changed, 68 insertions, 0 deletions
diff --git a/chrome/browser/browsing_data_appcache_helper.cc b/chrome/browser/browsing_data_appcache_helper.cc
new file mode 100644
index 0000000..c0d7ced
--- /dev/null
+++ b/chrome/browser/browsing_data_appcache_helper.cc
@@ -0,0 +1,68 @@
+// Copyright (c) 2010 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 "chrome/browser/browsing_data_appcache_helper.h"
+
+BrowsingDataAppCacheHelper::BrowsingDataAppCacheHelper(Profile* profile)
+ : is_fetching_(false) {
+}
+
+void BrowsingDataAppCacheHelper::StartFetching(Callback0::Type* callback) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
+ DCHECK(!is_fetching_);
+ DCHECK(callback);
+ is_fetching_ = true;
+ info_list_.clear();
+ completion_callback_.reset(callback);
+ ChromeThread::PostTask(ChromeThread::IO, FROM_HERE, NewRunnableMethod(
+ this, &BrowsingDataAppCacheHelper::StartFetchingInIOThread));
+}
+
+void BrowsingDataAppCacheHelper::CancelNotification() {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
+ completion_callback_.reset();
+}
+
+void BrowsingDataAppCacheHelper::DeleteAppCache(int64 group_id) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
+ ChromeThread::PostTask(ChromeThread::IO, FROM_HERE, NewRunnableMethod(
+ this, &BrowsingDataAppCacheHelper::DeleteAppCacheInIOThread,
+ group_id));
+}
+
+void BrowsingDataAppCacheHelper::StartFetchingInIOThread() {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
+
+#ifndef NDEBUG
+ // TODO(michaeln): get real data from the appcache service
+ info_list_.push_back(
+ AppCacheInfo(GURL("http://bogus/manifest"),
+ 1 * 1024 * 1024, base::Time::Now(), base::Time::Now(), 1));
+ info_list_.push_back(
+ AppCacheInfo(GURL("https://bogus/manifest"),
+ 2 * 1024 * 1024, base::Time::Now(), base::Time::Now(), 2));
+ info_list_.push_back(
+ AppCacheInfo(GURL("http://bogus:8080/manifest"),
+ 3 * 1024 * 1024, base::Time::Now(), base::Time::Now(), 3));
+#endif
+
+ ChromeThread::PostTask(ChromeThread::UI, FROM_HERE, NewRunnableMethod(
+ this, &BrowsingDataAppCacheHelper::OnFetchComplete));
+}
+
+void BrowsingDataAppCacheHelper::OnFetchComplete() {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
+ DCHECK(is_fetching_);
+ is_fetching_ = false;
+ if (completion_callback_ != NULL) {
+ completion_callback_->Run();
+ completion_callback_.reset();
+ }
+}
+
+void BrowsingDataAppCacheHelper::DeleteAppCacheInIOThread(
+ int64 group_id) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
+ // TODO(michaeln): plumb to the appcache service
+}