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

Side by Side Diff: chrome/browser/browsing_data_quota_helper.h

Issue 7387007: Adding usage and quota entry to chrome://settings/cookies. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 9 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_BROWSING_DATA_QUOTA_HELPER_H_
6 #define CHROME_BROWSER_BROWSING_DATA_QUOTA_HELPER_H_
7 #pragma once
8
9 #include <string>
10 #include <vector>
11
12 #include "base/callback_old.h"
13 #include "base/memory/ref_counted.h"
14 #include "base/message_loop_proxy.h"
15 #include "base/time.h"
16 #include "content/browser/browser_thread.h"
17 #include "webkit/quota/quota_types.h"
18
19 class Profile;
20
21 namespace quota {
22 class QuotaManager;
23 }
24
25 class BrowsingDataQuotaHelper;
26
27 struct BrowsingDataQuotaHelperDeleter {
28 static void Destruct(const BrowsingDataQuotaHelper* helper);
29 };
30
31 // This class is an interface class to bridge between Cookies Tree and Unified
32 // Quota System. This class provides a way to get usage and quota information
33 // through the instance.
34 //
35 // Call Create to create an instance for a profile and call StartFetching with
36 // a callback to fetch information asynchronously. If result is no longer needed
37 // after StartFetching, call CancelNotification to prevent callback.
38 //
39 // Parallel fetching is not allowed, a fetching task should start after end of
40 // previous task. All method of this class should called from UI thread.
41 class BrowsingDataQuotaHelper
42 : public base::RefCountedThreadSafe<BrowsingDataQuotaHelper,
43 BrowsingDataQuotaHelperDeleter> {
44 public:
45 // QuotaInfo contains host-based quota and usage informations for persistent
46 // and temporary storage.
47 struct QuotaInfo {
48 QuotaInfo();
49 explicit QuotaInfo(const std::string& host);
50 QuotaInfo(const std::string& host,
51 int64 temporary_usage,
52 int64 persistent_usage,
53 int64 persistent_quota);
54 ~QuotaInfo();
55
56 std::string host;
57 int64 temporary_usage;
58 int64 persistent_usage;
59 int64 persistent_quota;
60 };
61
62 typedef std::vector<QuotaInfo> QuotaInfoList;
63 typedef Callback1<const QuotaInfoList&>::Type FetchResultCallback;
64
65 static BrowsingDataQuotaHelper* Create(Profile* profile);
66
67 virtual void StartFetching(FetchResultCallback* callback) = 0;
68 virtual void CancelNotification() = 0;
69
70 // We don't support deletion now.
71 virtual void DeleteQuotaHost(const std::string& host) { }
72
73 protected:
74 explicit BrowsingDataQuotaHelper(base::MessageLoopProxy* io_thread_);
75 virtual ~BrowsingDataQuotaHelper();
76
77 private:
78 friend class DeleteTask<const BrowsingDataQuotaHelper>;
79 friend struct BrowsingDataQuotaHelperDeleter;
80 scoped_refptr<base::MessageLoopProxy> io_thread_;
81
82 DISALLOW_COPY_AND_ASSIGN(BrowsingDataQuotaHelper);
83 };
84
85 bool operator <(const BrowsingDataQuotaHelper::QuotaInfo& lhs,
86 const BrowsingDataQuotaHelper::QuotaInfo& rhs);
87 bool operator ==(const BrowsingDataQuotaHelper::QuotaInfo& lhs,
88 const BrowsingDataQuotaHelper::QuotaInfo& rhs);
89
90 #endif // CHROME_BROWSER_BROWSING_DATA_QUOTA_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698