OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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_QUOTA_HELPER_H_ | 5 #ifndef CHROME_BROWSER_BROWSING_DATA_QUOTA_HELPER_H_ |
6 #define CHROME_BROWSER_BROWSING_DATA_QUOTA_HELPER_H_ | 6 #define CHROME_BROWSER_BROWSING_DATA_QUOTA_HELPER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 #include <string> | 10 #include <string> |
(...skipping 29 matching lines...) Expand all Loading... |
40 // QuotaInfo contains host-based quota and usage information for persistent | 40 // QuotaInfo contains host-based quota and usage information for persistent |
41 // and temporary storage. | 41 // and temporary storage. |
42 struct QuotaInfo { | 42 struct QuotaInfo { |
43 QuotaInfo(); | 43 QuotaInfo(); |
44 explicit QuotaInfo(const std::string& host); | 44 explicit QuotaInfo(const std::string& host); |
45 QuotaInfo(const std::string& host, | 45 QuotaInfo(const std::string& host, |
46 int64 temporary_usage, | 46 int64 temporary_usage, |
47 int64 persistent_usage); | 47 int64 persistent_usage); |
48 ~QuotaInfo(); | 48 ~QuotaInfo(); |
49 | 49 |
| 50 // Certain versions of MSVC 2008 have bad implementations of ADL for nested |
| 51 // classes so they require these operators to be declared here instead of in |
| 52 // the global namespace. |
| 53 bool operator <(const QuotaInfo& rhs) const; |
| 54 bool operator ==(const QuotaInfo& rhs) const; |
| 55 |
50 std::string host; | 56 std::string host; |
51 int64 temporary_usage; | 57 int64 temporary_usage; |
52 int64 persistent_usage; | 58 int64 persistent_usage; |
53 }; | 59 }; |
54 | 60 |
55 typedef std::list<QuotaInfo> QuotaInfoArray; | 61 typedef std::list<QuotaInfo> QuotaInfoArray; |
56 typedef base::Callback<void(const QuotaInfoArray&)> FetchResultCallback; | 62 typedef base::Callback<void(const QuotaInfoArray&)> FetchResultCallback; |
57 | 63 |
58 static BrowsingDataQuotaHelper* Create(Profile* profile); | 64 static BrowsingDataQuotaHelper* Create(Profile* profile); |
59 | 65 |
60 virtual void StartFetching(const FetchResultCallback& callback) = 0; | 66 virtual void StartFetching(const FetchResultCallback& callback) = 0; |
61 virtual void CancelNotification() = 0; | 67 virtual void CancelNotification() = 0; |
62 | 68 |
63 virtual void RevokeHostQuota(const std::string& host) = 0; | 69 virtual void RevokeHostQuota(const std::string& host) = 0; |
64 | 70 |
65 protected: | 71 protected: |
66 explicit BrowsingDataQuotaHelper(base::MessageLoopProxy* io_thread_); | 72 explicit BrowsingDataQuotaHelper(base::MessageLoopProxy* io_thread_); |
67 virtual ~BrowsingDataQuotaHelper(); | 73 virtual ~BrowsingDataQuotaHelper(); |
68 | 74 |
69 private: | 75 private: |
70 friend class DeleteTask<const BrowsingDataQuotaHelper>; | 76 friend class DeleteTask<const BrowsingDataQuotaHelper>; |
71 friend struct BrowsingDataQuotaHelperDeleter; | 77 friend struct BrowsingDataQuotaHelperDeleter; |
72 scoped_refptr<base::MessageLoopProxy> io_thread_; | 78 scoped_refptr<base::MessageLoopProxy> io_thread_; |
73 | 79 |
74 DISALLOW_COPY_AND_ASSIGN(BrowsingDataQuotaHelper); | 80 DISALLOW_COPY_AND_ASSIGN(BrowsingDataQuotaHelper); |
75 }; | 81 }; |
76 | 82 |
77 bool operator <(const BrowsingDataQuotaHelper::QuotaInfo& lhs, | |
78 const BrowsingDataQuotaHelper::QuotaInfo& rhs); | |
79 bool operator ==(const BrowsingDataQuotaHelper::QuotaInfo& lhs, | |
80 const BrowsingDataQuotaHelper::QuotaInfo& rhs); | |
81 | |
82 #endif // CHROME_BROWSER_BROWSING_DATA_QUOTA_HELPER_H_ | 83 #endif // CHROME_BROWSER_BROWSING_DATA_QUOTA_HELPER_H_ |
OLD | NEW |