summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browsing_data_quota_helper_impl.h
diff options
context:
space:
mode:
authortzik@chromium.org <tzik@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-09 06:48:30 +0000
committertzik@chromium.org <tzik@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-09 06:48:30 +0000
commita9e3ec4a7fa2bc3fa29ce457353376fb7726af0d (patch)
treec938b4f1f975028c0f7d674fb7f67763e9c7f8bf /chrome/browser/browsing_data_quota_helper_impl.h
parentafecb884880931e4926c28874f4932dc9ae2319c (diff)
downloadchromium_src-a9e3ec4a7fa2bc3fa29ce457353376fb7726af0d.zip
chromium_src-a9e3ec4a7fa2bc3fa29ce457353376fb7726af0d.tar.gz
chromium_src-a9e3ec4a7fa2bc3fa29ce457353376fb7726af0d.tar.bz2
Adding usage entry to chrome://settings/cookies.
BUG=88644,91816,91836 TEST='BrowsingDataQuotaHelperTest.*' Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=95607 Reverted: http://src.chromium.org/viewvc/chrome?view=rev&revision=95779 Review URL: http://codereview.chromium.org/7387007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95959 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browsing_data_quota_helper_impl.h')
-rw-r--r--chrome/browser/browsing_data_quota_helper_impl.h75
1 files changed, 75 insertions, 0 deletions
diff --git a/chrome/browser/browsing_data_quota_helper_impl.h b/chrome/browser/browsing_data_quota_helper_impl.h
new file mode 100644
index 0000000..83e4516
--- /dev/null
+++ b/chrome/browser/browsing_data_quota_helper_impl.h
@@ -0,0 +1,75 @@
+// Copyright (c) 2011 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.
+
+#ifndef CHROME_BROWSER_BROWSING_DATA_QUOTA_HELPER_IMPL_H_
+#define CHROME_BROWSER_BROWSING_DATA_QUOTA_HELPER_IMPL_H_
+#pragma once
+
+#include <map>
+#include <set>
+#include <string>
+#include <utility>
+#include <vector>
+
+#include "base/callback_old.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_callback_factory.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/time.h"
+#include "chrome/browser/browsing_data_quota_helper.h"
+#include "content/browser/browser_thread.h"
+#include "webkit/quota/quota_types.h"
+
+namespace quota {
+class QuotaManager;
+}
+
+// Implementation of BrowsingDataQuotaHelper. Since a client of
+// BrowsingDataQuotaHelper should live in UI thread and QuotaManager lives in
+// IO thread, we have to communicate over thread using PostTask.
+class BrowsingDataQuotaHelperImpl : public BrowsingDataQuotaHelper {
+ public:
+ virtual void StartFetching(FetchResultCallback* callback) OVERRIDE;
+ virtual void CancelNotification() OVERRIDE;
+
+ private:
+ void FetchQuotaInfo();
+ void OnComplete();
+
+ void GetHostUsage(const std::string& host, quota::StorageType type);
+ void ProcessPendingHosts();
+
+ // Callback function for GetOriginModifiedSince.
+ void GotOrigins(const std::set<GURL>& origins, quota::StorageType type);
+
+ // Callback function for GetHostUsage.
+ void GotHostUsage(const std::string& host,
+ quota::StorageType type,
+ int64 usage);
+
+ explicit BrowsingDataQuotaHelperImpl(base::MessageLoopProxy* ui_thread,
+ base::MessageLoopProxy* io_thread,
+ quota::QuotaManager* quota_manager);
+ virtual ~BrowsingDataQuotaHelperImpl();
+
+ scoped_refptr<quota::QuotaManager> quota_manager_;
+ scoped_ptr<FetchResultCallback> callback_;
+
+ typedef std::set<std::pair<std::string, quota::StorageType> > PendingHosts;
+ PendingHosts pending_hosts_;
+ std::map<std::string, QuotaInfo> quota_info_;
+
+ bool is_fetching_;
+
+ scoped_refptr<base::MessageLoopProxy> ui_thread_;
+ scoped_refptr<base::MessageLoopProxy> io_thread_;
+ base::ScopedCallbackFactory<BrowsingDataQuotaHelperImpl> callback_factory_;
+
+ friend class BrowsingDataQuotaHelper;
+ friend class BrowsingDataQuotaHelperTest;
+
+ DISALLOW_COPY_AND_ASSIGN(BrowsingDataQuotaHelperImpl);
+};
+
+#endif // CHROME_BROWSER_BROWSING_DATA_QUOTA_HELPER_IMPL_H_