| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_QUOTA_HELPER_H_ | 5 #ifndef CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_QUOTA_HELPER_H_ |
| 6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_QUOTA_HELPER_H_ | 6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_QUOTA_HELPER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> |
| 9 |
| 8 #include <list> | 10 #include <list> |
| 9 #include <string> | 11 #include <string> |
| 10 | 12 |
| 11 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 13 #include "base/sequenced_task_runner_helpers.h" | 16 #include "base/sequenced_task_runner_helpers.h" |
| 14 #include "storage/common/quota/quota_types.h" | 17 #include "storage/common/quota/quota_types.h" |
| 15 | 18 |
| 16 class BrowsingDataQuotaHelper; | 19 class BrowsingDataQuotaHelper; |
| 17 class Profile; | 20 class Profile; |
| 18 | 21 |
| 19 struct BrowsingDataQuotaHelperDeleter { | 22 struct BrowsingDataQuotaHelperDeleter { |
| 20 static void Destruct(const BrowsingDataQuotaHelper* helper); | 23 static void Destruct(const BrowsingDataQuotaHelper* helper); |
| 21 }; | 24 }; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 32 class BrowsingDataQuotaHelper | 35 class BrowsingDataQuotaHelper |
| 33 : public base::RefCountedThreadSafe<BrowsingDataQuotaHelper, | 36 : public base::RefCountedThreadSafe<BrowsingDataQuotaHelper, |
| 34 BrowsingDataQuotaHelperDeleter> { | 37 BrowsingDataQuotaHelperDeleter> { |
| 35 public: | 38 public: |
| 36 // QuotaInfo contains host-based quota and usage information for persistent | 39 // QuotaInfo contains host-based quota and usage information for persistent |
| 37 // and temporary storage. | 40 // and temporary storage. |
| 38 struct QuotaInfo { | 41 struct QuotaInfo { |
| 39 QuotaInfo(); | 42 QuotaInfo(); |
| 40 explicit QuotaInfo(const std::string& host); | 43 explicit QuotaInfo(const std::string& host); |
| 41 QuotaInfo(const std::string& host, | 44 QuotaInfo(const std::string& host, |
| 42 int64 temporary_usage, | 45 int64_t temporary_usage, |
| 43 int64 persistent_usage, | 46 int64_t persistent_usage, |
| 44 int64 syncable_usage); | 47 int64_t syncable_usage); |
| 45 ~QuotaInfo(); | 48 ~QuotaInfo(); |
| 46 | 49 |
| 47 // Certain versions of MSVC 2008 have bad implementations of ADL for nested | 50 // Certain versions of MSVC 2008 have bad implementations of ADL for nested |
| 48 // classes so they require these operators to be declared here instead of in | 51 // classes so they require these operators to be declared here instead of in |
| 49 // the global namespace. | 52 // the global namespace. |
| 50 bool operator <(const QuotaInfo& rhs) const; | 53 bool operator <(const QuotaInfo& rhs) const; |
| 51 bool operator ==(const QuotaInfo& rhs) const; | 54 bool operator ==(const QuotaInfo& rhs) const; |
| 52 | 55 |
| 53 std::string host; | 56 std::string host; |
| 54 int64 temporary_usage = 0; | 57 int64_t temporary_usage = 0; |
| 55 int64 persistent_usage = 0; | 58 int64_t persistent_usage = 0; |
| 56 int64 syncable_usage = 0; | 59 int64_t syncable_usage = 0; |
| 57 }; | 60 }; |
| 58 | 61 |
| 59 typedef std::list<QuotaInfo> QuotaInfoArray; | 62 typedef std::list<QuotaInfo> QuotaInfoArray; |
| 60 typedef base::Callback<void(const QuotaInfoArray&)> FetchResultCallback; | 63 typedef base::Callback<void(const QuotaInfoArray&)> FetchResultCallback; |
| 61 | 64 |
| 62 static BrowsingDataQuotaHelper* Create(Profile* profile); | 65 static BrowsingDataQuotaHelper* Create(Profile* profile); |
| 63 | 66 |
| 64 virtual void StartFetching(const FetchResultCallback& callback) = 0; | 67 virtual void StartFetching(const FetchResultCallback& callback) = 0; |
| 65 | 68 |
| 66 virtual void RevokeHostQuota(const std::string& host) = 0; | 69 virtual void RevokeHostQuota(const std::string& host) = 0; |
| 67 | 70 |
| 68 protected: | 71 protected: |
| 69 BrowsingDataQuotaHelper(); | 72 BrowsingDataQuotaHelper(); |
| 70 virtual ~BrowsingDataQuotaHelper(); | 73 virtual ~BrowsingDataQuotaHelper(); |
| 71 | 74 |
| 72 private: | 75 private: |
| 73 friend class base::DeleteHelper<BrowsingDataQuotaHelper>; | 76 friend class base::DeleteHelper<BrowsingDataQuotaHelper>; |
| 74 friend struct BrowsingDataQuotaHelperDeleter; | 77 friend struct BrowsingDataQuotaHelperDeleter; |
| 75 | 78 |
| 76 DISALLOW_COPY_AND_ASSIGN(BrowsingDataQuotaHelper); | 79 DISALLOW_COPY_AND_ASSIGN(BrowsingDataQuotaHelper); |
| 77 }; | 80 }; |
| 78 | 81 |
| 79 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_QUOTA_HELPER_H_ | 82 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_QUOTA_HELPER_H_ |
| OLD | NEW |