| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 COMPONENTS_BROWSING_DATA_CONTENT_CONDITIONAL_CACHE_DELETION_HELPER_H_ | 5 #ifndef CONTENT_BROWSER_BROWSING_DATA_CONDITIONAL_CACHE_DELETION_HELPER_H_ |
| 6 #define COMPONENTS_BROWSING_DATA_CONTENT_CONDITIONAL_CACHE_DELETION_HELPER_H_ | 6 #define CONTENT_BROWSER_BROWSING_DATA_CONDITIONAL_CACHE_DELETION_HELPER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "content/common/content_export.h" |
| 12 #include "net/base/completion_callback.h" | 13 #include "net/base/completion_callback.h" |
| 13 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
| 14 #include "net/disk_cache/disk_cache.h" | 15 #include "net/disk_cache/disk_cache.h" |
| 15 #include "url/gurl.h" | 16 #include "url/gurl.h" |
| 16 | 17 |
| 17 namespace disk_cache { | 18 namespace disk_cache { |
| 18 class Entry; | 19 class Entry; |
| 19 } | 20 } |
| 20 | 21 |
| 21 namespace browsing_data { | 22 namespace content { |
| 22 | 23 |
| 23 // Helper to remove http cache data from a StoragePartition. | 24 // Helper to remove http cache data from a StoragePartition. |
| 24 class ConditionalCacheDeletionHelper { | 25 class CONTENT_EXPORT ConditionalCacheDeletionHelper { |
| 25 public: | 26 public: |
| 26 // Creates a helper to delete |cache| entries that match the |condition|. | 27 // Creates a helper to delete |cache| entries that match the |condition|. |
| 27 // Must be created on the IO thread! | 28 // Must be created on the IO thread! |
| 28 ConditionalCacheDeletionHelper( | 29 ConditionalCacheDeletionHelper( |
| 29 disk_cache::Backend* cache, | 30 disk_cache::Backend* cache, |
| 30 const base::Callback<bool(const disk_cache::Entry*)>& condition); | 31 const base::Callback<bool(const disk_cache::Entry*)>& condition); |
| 31 | 32 |
| 32 // A convenience method to create a condition matching cache entries whose | 33 // A convenience method to create a condition matching cache entries whose |
| 33 // last modified time is between |begin_time| (inclusively), |end_time| | 34 // last modified time is between |begin_time| (inclusively), |end_time| |
| 34 // (exclusively) and whose URL is matched by the |url_predicate|. Note that | 35 // (exclusively) and whose URL is matched by the |url_predicate|. Note that |
| (...skipping 26 matching lines...) Expand all Loading... |
| 61 | 62 |
| 62 net::CompletionCallback completion_callback_; | 63 net::CompletionCallback completion_callback_; |
| 63 | 64 |
| 64 std::unique_ptr<disk_cache::Backend::Iterator> iterator_; | 65 std::unique_ptr<disk_cache::Backend::Iterator> iterator_; |
| 65 disk_cache::Entry* current_entry_; | 66 disk_cache::Entry* current_entry_; |
| 66 disk_cache::Entry* previous_entry_; | 67 disk_cache::Entry* previous_entry_; |
| 67 | 68 |
| 68 DISALLOW_COPY_AND_ASSIGN(ConditionalCacheDeletionHelper); | 69 DISALLOW_COPY_AND_ASSIGN(ConditionalCacheDeletionHelper); |
| 69 }; | 70 }; |
| 70 | 71 |
| 71 } // namespace browsing_data | 72 } // namespace content |
| 72 | 73 |
| 73 #endif // COMPONENTS_BROWSING_DATA_CONTENT_CONDITIONAL_CACHE_DELETION_HELPER_H_ | 74 #endif // CONTENT_BROWSER_BROWSING_DATA_CONDITIONAL_CACHE_DELETION_HELPER_H_ |
| OLD | NEW |