Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(435)

Unified Diff: components/offline_pages/offline_page_storage_manager.h

Issue 1970953002: [Offline Pages] Adding more expiration logic. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@interface
Patch Set: More comments. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/offline_pages/offline_page_storage_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/offline_pages/offline_page_storage_manager.h
diff --git a/components/offline_pages/offline_page_storage_manager.h b/components/offline_pages/offline_page_storage_manager.h
index cf1dc7f6c9f4fb679194b374f91773d34302a0db..eebcff6c4538c66f0200b30d4008f80df6eceeb5 100644
--- a/components/offline_pages/offline_page_storage_manager.h
+++ b/components/offline_pages/offline_page_storage_manager.h
@@ -14,6 +14,10 @@
#include "base/memory/weak_ptr.h"
#include "components/offline_pages/offline_page_types.h"
+namespace base {
+class Clock;
+}
+
namespace offline_pages {
class ClientPolicyController;
@@ -56,6 +60,9 @@ class OfflinePageStorageManager {
// pages (if clearing condition wasn't satisfied).
void ClearPagesIfNeeded(const ClearPageCallback& callback);
+ // Sets the clock for testing.
+ void SetClockForTesting(std::unique_ptr<base::Clock> clock);
+
private:
// Selects and removes pages that need to be expired. Triggered as a callback
// to |GetAllPages|.
@@ -74,8 +81,8 @@ class OfflinePageStorageManager {
// Determine if manager should clear pages.
bool ShouldClearPages();
- // Return true if |page| is expired.
- bool IsPageExpired(const OfflinePageItem& page);
+ // Return true if |page| is expired comparing to |now|.
+ bool ShouldBeExpired(const base::Time& now, const OfflinePageItem& page);
// Not owned.
Client* client_;
@@ -85,6 +92,9 @@ class OfflinePageStorageManager {
bool in_progress_;
+ // Clock for getting time.
+ std::unique_ptr<base::Clock> clock_;
+
base::WeakPtrFactory<OfflinePageStorageManager> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(OfflinePageStorageManager);
« no previous file with comments | « no previous file | components/offline_pages/offline_page_storage_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698