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 <string> | 10 #include <string> |
10 #include <vector> | |
11 | 11 |
12 #include "base/callback_old.h" | 12 #include "base/callback_old.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/message_loop_proxy.h" | 14 #include "base/message_loop_proxy.h" |
15 #include "base/time.h" | 15 #include "base/time.h" |
16 #include "content/browser/browser_thread.h" | 16 #include "content/browser/browser_thread.h" |
17 #include "webkit/quota/quota_types.h" | 17 #include "webkit/quota/quota_types.h" |
18 | 18 |
19 class Profile; | 19 class Profile; |
20 | 20 |
(...skipping 29 matching lines...) Expand all Loading... |
50 QuotaInfo(const std::string& host, | 50 QuotaInfo(const std::string& host, |
51 int64 temporary_usage, | 51 int64 temporary_usage, |
52 int64 persistent_usage); | 52 int64 persistent_usage); |
53 ~QuotaInfo(); | 53 ~QuotaInfo(); |
54 | 54 |
55 std::string host; | 55 std::string host; |
56 int64 temporary_usage; | 56 int64 temporary_usage; |
57 int64 persistent_usage; | 57 int64 persistent_usage; |
58 }; | 58 }; |
59 | 59 |
60 typedef std::vector<QuotaInfo> QuotaInfoArray; | 60 typedef std::list<QuotaInfo> QuotaInfoArray; |
61 typedef Callback1<const QuotaInfoArray&>::Type FetchResultCallback; | 61 typedef Callback1<const QuotaInfoArray&>::Type FetchResultCallback; |
62 | 62 |
63 static BrowsingDataQuotaHelper* Create(Profile* profile); | 63 static BrowsingDataQuotaHelper* Create(Profile* profile); |
64 | 64 |
65 virtual void StartFetching(FetchResultCallback* callback) = 0; | 65 virtual void StartFetching(FetchResultCallback* callback) = 0; |
66 virtual void CancelNotification() = 0; | 66 virtual void CancelNotification() = 0; |
67 | 67 |
68 // We don't support deletion now. | 68 // We don't support deletion now. |
69 virtual void DeleteQuotaHost(const std::string& host) {} | 69 virtual void DeleteQuotaHost(const std::string& host) {} |
70 | 70 |
71 protected: | 71 protected: |
72 explicit BrowsingDataQuotaHelper(base::MessageLoopProxy* io_thread_); | 72 explicit BrowsingDataQuotaHelper(base::MessageLoopProxy* io_thread_); |
73 virtual ~BrowsingDataQuotaHelper(); | 73 virtual ~BrowsingDataQuotaHelper(); |
74 | 74 |
75 private: | 75 private: |
76 friend class DeleteTask<const BrowsingDataQuotaHelper>; | 76 friend class DeleteTask<const BrowsingDataQuotaHelper>; |
77 friend struct BrowsingDataQuotaHelperDeleter; | 77 friend struct BrowsingDataQuotaHelperDeleter; |
78 scoped_refptr<base::MessageLoopProxy> io_thread_; | 78 scoped_refptr<base::MessageLoopProxy> io_thread_; |
79 | 79 |
80 DISALLOW_COPY_AND_ASSIGN(BrowsingDataQuotaHelper); | 80 DISALLOW_COPY_AND_ASSIGN(BrowsingDataQuotaHelper); |
81 }; | 81 }; |
82 | 82 |
83 bool operator <(const BrowsingDataQuotaHelper::QuotaInfo& lhs, | 83 bool operator <(const BrowsingDataQuotaHelper::QuotaInfo& lhs, |
84 const BrowsingDataQuotaHelper::QuotaInfo& rhs); | 84 const BrowsingDataQuotaHelper::QuotaInfo& rhs); |
85 bool operator ==(const BrowsingDataQuotaHelper::QuotaInfo& lhs, | 85 bool operator ==(const BrowsingDataQuotaHelper::QuotaInfo& lhs, |
86 const BrowsingDataQuotaHelper::QuotaInfo& rhs); | 86 const BrowsingDataQuotaHelper::QuotaInfo& rhs); |
87 | 87 |
88 #endif // CHROME_BROWSER_BROWSING_DATA_QUOTA_HELPER_H_ | 88 #endif // CHROME_BROWSER_BROWSING_DATA_QUOTA_HELPER_H_ |
OLD | NEW |