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

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

Issue 10805015: Move browsing_data_helper files into a separate directory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix chrome_frame build Created 8 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) 2012 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
8 #include <list>
9 #include <string>
10
11 #include "base/callback.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/message_loop_proxy.h"
14 #include "base/sequenced_task_runner_helpers.h"
15 #include "base/time.h"
16 #include "content/public/browser/browser_thread.h"
17 #include "webkit/quota/quota_types.h"
18
19 class BrowsingDataQuotaHelper;
20 class Profile;
21
22 struct BrowsingDataQuotaHelperDeleter {
23 static void Destruct(const BrowsingDataQuotaHelper* helper);
24 };
25
26 // This class is an interface class to bridge between Cookies Tree and Unified
27 // Quota System. This class provides a way to get usage and quota information
28 // through the instance.
29 //
30 // Call Create to create an instance for a profile and call StartFetching with
31 // a callback to fetch information asynchronously.
32 //
33 // Parallel fetching is not allowed, a fetching task should start after end of
34 // previous task. All method of this class should called from UI thread.
35 class BrowsingDataQuotaHelper
36 : public base::RefCountedThreadSafe<BrowsingDataQuotaHelper,
37 BrowsingDataQuotaHelperDeleter> {
38 public:
39 // QuotaInfo contains host-based quota and usage information for persistent
40 // and temporary storage.
41 struct QuotaInfo {
42 QuotaInfo();
43 explicit QuotaInfo(const std::string& host);
44 QuotaInfo(const std::string& host,
45 int64 temporary_usage,
46 int64 persistent_usage);
47 ~QuotaInfo();
48
49 // Certain versions of MSVC 2008 have bad implementations of ADL for nested
50 // classes so they require these operators to be declared here instead of in
51 // the global namespace.
52 bool operator <(const QuotaInfo& rhs) const;
53 bool operator ==(const QuotaInfo& rhs) const;
54
55 std::string host;
56 int64 temporary_usage;
57 int64 persistent_usage;
58 };
59
60 typedef std::list<QuotaInfo> QuotaInfoArray;
61 typedef base::Callback<void(const QuotaInfoArray&)> FetchResultCallback;
62
63 static BrowsingDataQuotaHelper* Create(Profile* profile);
64
65 virtual void StartFetching(const FetchResultCallback& callback) = 0;
66
67 virtual void RevokeHostQuota(const std::string& host) = 0;
68
69 protected:
70 explicit BrowsingDataQuotaHelper(base::MessageLoopProxy* io_thread_);
71 virtual ~BrowsingDataQuotaHelper();
72
73 private:
74 friend class base::DeleteHelper<BrowsingDataQuotaHelper>;
75 friend struct BrowsingDataQuotaHelperDeleter;
76 scoped_refptr<base::MessageLoopProxy> io_thread_;
77
78 DISALLOW_COPY_AND_ASSIGN(BrowsingDataQuotaHelper);
79 };
80
81 #endif // CHROME_BROWSER_BROWSING_DATA_QUOTA_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data_local_storage_helper_unittest.cc ('k') | chrome/browser/browsing_data_quota_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698