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

Unified Diff: components/offline_pages/offline_page_model.h

Issue 1947323002: [Offline Pages] Implement OfflinePageStorageManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix rebasing 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 | « components/offline_pages/BUILD.gn ('k') | components/offline_pages/offline_page_model.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/offline_pages/offline_page_model.h
diff --git a/components/offline_pages/offline_page_model.h b/components/offline_pages/offline_page_model.h
index 117c126751cd5eecb3578cf2eb7bf3cf0e5a4da1..90ed8bfbe1ad4a2b63a99b0904d76cee594b186d 100644
--- a/components/offline_pages/offline_page_model.h
+++ b/components/offline_pages/offline_page_model.h
@@ -41,8 +41,10 @@ static const int64_t kInvalidOfflineId = 0;
struct ClientId;
+class ClientPolicyController;
struct OfflinePageItem;
class OfflinePageMetadataStore;
+class OfflinePageStorageManager;
// Service for saving pages offline, storing the offline copy and metadata, and
// retrieving them upon request.
@@ -177,8 +179,9 @@ class OfflinePageModel : public KeyedService, public base::SupportsUserData {
const DeletePageCallback& callback);
// Deletes offline pages related to the passed |offline_ids|.
- void DeletePagesByOfflineId(const std::vector<int64_t>& offline_ids,
- const DeletePageCallback& callback);
+ // Making virtual for test purposes.
+ virtual void DeletePagesByOfflineId(const std::vector<int64_t>& offline_ids,
+ const DeletePageCallback& callback);
// Wipes out all the data by deleting all saved files and clearing the store.
void ClearAll(const base::Closure& callback);
@@ -199,7 +202,8 @@ class OfflinePageModel : public KeyedService, public base::SupportsUserData {
const CheckPagesExistOfflineCallback& callback);
// Gets all available offline pages.
- void GetAllPages(const MultipleOfflinePageItemCallback& callback);
+ // Making virtual for test purposes.
+ virtual void GetAllPages(const MultipleOfflinePageItemCallback& callback);
// Gets all offline ids where the offline page has the matching client id.
void GetOfflineIdsForClientId(const ClientId& client_id,
@@ -259,10 +263,22 @@ class OfflinePageModel : public KeyedService, public base::SupportsUserData {
int64_t free_space_bytes,
bool reporting_after_delete);
+ // Returns the policy controller.
+ // Making virtual for test purposes.
+ virtual ClientPolicyController* GetPolicyController();
+
// Methods for testing only:
OfflinePageMetadataStore* GetStoreForTesting();
- bool is_loaded() const { return is_loaded_; }
+ OfflinePageStorageManager* GetStorageManager();
+
+ // Making virtual for test purposes.
+ virtual bool is_loaded() const;
+
+ protected:
+ // Adding a protected constructor for testing-only purposes in
+ // offline_page_storage_manager_unittest.cc
+ OfflinePageModel();
private:
FRIEND_TEST_ALL_PREFIXES(OfflinePageModelTest, MarkPageForDeletion);
@@ -384,6 +400,13 @@ class OfflinePageModel : public KeyedService, public base::SupportsUserData {
// Delayed tasks that should be invoked after the loading is done.
std::vector<base::Closure> delayed_tasks_;
+ // Controller of the client policies.
+ std::unique_ptr<ClientPolicyController> policy_controller_;
+
+ // Manager for the storage consumed by archives and responsible for
+ // automatic page clearing.
+ std::unique_ptr<OfflinePageStorageManager> storage_manager_;
+
base::WeakPtrFactory<OfflinePageModel> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(OfflinePageModel);
« no previous file with comments | « components/offline_pages/BUILD.gn ('k') | components/offline_pages/offline_page_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698