OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_CACHE_STORAGE_HELPER_H_ | 5 #ifndef CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_CACHE_STORAGE_HELPER_H_ |
6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_CACHE_STORAGE_HELPER_H_ | 6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_CACHE_STORAGE_HELPER_H_ |
7 | 7 |
| 8 #include <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
8 #include <list> | 11 #include <list> |
9 #include <set> | 12 #include <set> |
10 | 13 |
11 #include "base/callback.h" | 14 #include "base/callback.h" |
| 15 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
13 #include "base/time/time.h" | 17 #include "base/time/time.h" |
14 #include "content/public/browser/cache_storage_context.h" | 18 #include "content/public/browser/cache_storage_context.h" |
15 #include "content/public/browser/cache_storage_usage_info.h" | 19 #include "content/public/browser/cache_storage_usage_info.h" |
16 #include "url/gurl.h" | 20 #include "url/gurl.h" |
17 | 21 |
18 // BrowsingDataCacheStorageHelper is an interface for classes dealing with | 22 // BrowsingDataCacheStorageHelper is an interface for classes dealing with |
19 // aggregating and deleting browsing data stored for Cache Storage. | 23 // aggregating and deleting browsing data stored for Cache Storage. |
20 // A client of this class need to call StartFetching from the UI thread to | 24 // A client of this class need to call StartFetching from the UI thread to |
21 // initiate the flow, and it'll be notified by the callback in its UI thread at | 25 // initiate the flow, and it'll be notified by the callback in its UI thread at |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 61 |
58 // This class is an implementation of BrowsingDataCacheStorageHelper that does | 62 // This class is an implementation of BrowsingDataCacheStorageHelper that does |
59 // not fetch its information from the Cache Storage context, but is passed the | 63 // not fetch its information from the Cache Storage context, but is passed the |
60 // info as a parameter. | 64 // info as a parameter. |
61 class CannedBrowsingDataCacheStorageHelper | 65 class CannedBrowsingDataCacheStorageHelper |
62 : public BrowsingDataCacheStorageHelper { | 66 : public BrowsingDataCacheStorageHelper { |
63 public: | 67 public: |
64 // Contains information about a Cache Storage. | 68 // Contains information about a Cache Storage. |
65 struct PendingCacheStorageUsageInfo { | 69 struct PendingCacheStorageUsageInfo { |
66 PendingCacheStorageUsageInfo(const GURL& origin, | 70 PendingCacheStorageUsageInfo(const GURL& origin, |
67 int64 total_size_bytes, | 71 int64_t total_size_bytes, |
68 const base::Time& last_modified); | 72 const base::Time& last_modified); |
69 ~PendingCacheStorageUsageInfo(); | 73 ~PendingCacheStorageUsageInfo(); |
70 | 74 |
71 bool operator<(const PendingCacheStorageUsageInfo& other) const; | 75 bool operator<(const PendingCacheStorageUsageInfo& other) const; |
72 | 76 |
73 GURL origin; | 77 GURL origin; |
74 int64 total_size_bytes; | 78 int64_t total_size_bytes; |
75 base::Time last_modified; | 79 base::Time last_modified; |
76 }; | 80 }; |
77 | 81 |
78 explicit CannedBrowsingDataCacheStorageHelper( | 82 explicit CannedBrowsingDataCacheStorageHelper( |
79 content::CacheStorageContext* context); | 83 content::CacheStorageContext* context); |
80 | 84 |
81 // Add a Cache Storage to the set of canned Cache Storages that is | 85 // Add a Cache Storage to the set of canned Cache Storages that is |
82 // returned by this helper. | 86 // returned by this helper. |
83 void AddCacheStorage(const GURL& origin); | 87 void AddCacheStorage(const GURL& origin); |
84 | 88 |
(...skipping 19 matching lines...) Expand all Loading... |
104 | 108 |
105 private: | 109 private: |
106 ~CannedBrowsingDataCacheStorageHelper() override; | 110 ~CannedBrowsingDataCacheStorageHelper() override; |
107 | 111 |
108 std::set<PendingCacheStorageUsageInfo> pending_cache_storage_info_; | 112 std::set<PendingCacheStorageUsageInfo> pending_cache_storage_info_; |
109 | 113 |
110 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataCacheStorageHelper); | 114 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataCacheStorageHelper); |
111 }; | 115 }; |
112 | 116 |
113 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_CACHE_STORAGE_HELPER_H_ | 117 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_CACHE_STORAGE_HELPER_H_ |
OLD | NEW |