Chromium Code Reviews| 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 COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_ |
| 6 #define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 129 // accessed. Its access info, including last access time and access count, | 129 // accessed. Its access info, including last access time and access count, |
| 130 // will be updated. Requires that the model is loaded. | 130 // will be updated. Requires that the model is loaded. |
| 131 void MarkPageAccessed(int64_t offline_id); | 131 void MarkPageAccessed(int64_t offline_id); |
| 132 | 132 |
| 133 // Deletes an offline page related to the passed |offline_id|. | 133 // Deletes an offline page related to the passed |offline_id|. |
| 134 void DeletePageByOfflineId(int64_t offline_id, | 134 void DeletePageByOfflineId(int64_t offline_id, |
| 135 const DeletePageCallback& callback); | 135 const DeletePageCallback& callback); |
| 136 | 136 |
| 137 // Deletes offline pages related to the passed |offline_ids|. | 137 // Deletes offline pages related to the passed |offline_ids|. |
| 138 void DeletePagesByOfflineId(const std::vector<int64_t>& offline_ids, | 138 void DeletePagesByOfflineId(const std::vector<int64_t>& offline_ids, |
| 139 const DeletePageCallback& callback) override; | 139 const DeletePageCallback& callback); |
| 140 | 140 |
| 141 // Wipes out all the data by deleting all saved files and clearing the store. | 141 // Wipes out all the data by deleting all saved files and clearing the store. |
| 142 void ClearAll(const base::Closure& callback); | 142 void ClearAll(const base::Closure& callback); |
| 143 | 143 |
| 144 // Deletes offline pages matching the URL predicate. | 144 // Deletes offline pages matching the URL predicate. |
| 145 void DeletePagesByURLPredicate(const UrlPredicate& predicate, | 145 void DeletePagesByURLPredicate(const UrlPredicate& predicate, |
| 146 const DeletePageCallback& callback); | 146 const DeletePageCallback& callback); |
| 147 | 147 |
| 148 // Returns true via callback if there are offline pages in the given | 148 // Returns true via callback if there are offline pages in the given |
| 149 // |name_space|. | 149 // |name_space|. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 211 | 211 |
| 212 // Checks that all of the offline pages have corresponding offline copies. | 212 // Checks that all of the offline pages have corresponding offline copies. |
| 213 // If a page is discovered to be missing an offline copy, its offline page | 213 // If a page is discovered to be missing an offline copy, its offline page |
| 214 // metadata will be removed and |OfflinePageDeleted| will be sent to model | 214 // metadata will be removed and |OfflinePageDeleted| will be sent to model |
| 215 // observers. | 215 // observers. |
| 216 void CheckForExternalFileDeletion(); | 216 void CheckForExternalFileDeletion(); |
| 217 | 217 |
| 218 // Marks pages as expired and removes their respective files from the archive | 218 // Marks pages as expired and removes their respective files from the archive |
| 219 // directory. | 219 // directory. |
| 220 void ExpirePages(const std::vector<int64_t>& offline_ids, | 220 void ExpirePages(const std::vector<int64_t>& offline_ids, |
| 221 const base::Time& expiration_time); | 221 const base::Time& expiration_time, |
| 222 const DeletePageCallback& callback) override; | |
| 223 | |
| 224 // Remove the pages from metadata store and in memory cache map. | |
| 225 void RemovePageItems(const std::vector<int64_t>& offline_ids, | |
|
jianli
2016/05/24 23:43:32
I think exposing this capability directly might be
romax
2016/05/25 20:05:23
I've added a check in DeletePagesByOfflineId to de
| |
| 226 const base::Callback<void(bool)>& callback) override; | |
| 222 | 227 |
| 223 // Returns the policy controller. | 228 // Returns the policy controller. |
| 224 ClientPolicyController* GetPolicyController(); | 229 ClientPolicyController* GetPolicyController(); |
| 225 | 230 |
| 226 // Methods for testing only: | 231 // Methods for testing only: |
| 227 OfflinePageMetadataStore* GetStoreForTesting(); | 232 OfflinePageMetadataStore* GetStoreForTesting(); |
| 228 | 233 |
| 229 OfflinePageStorageManager* GetStorageManager(); | 234 OfflinePageStorageManager* GetStorageManager(); |
| 230 | 235 |
| 231 bool is_loaded() const; | 236 bool is_loaded() const; |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 372 std::unique_ptr<ArchiveManager> archive_manager_; | 377 std::unique_ptr<ArchiveManager> archive_manager_; |
| 373 | 378 |
| 374 base::WeakPtrFactory<OfflinePageModel> weak_ptr_factory_; | 379 base::WeakPtrFactory<OfflinePageModel> weak_ptr_factory_; |
| 375 | 380 |
| 376 DISALLOW_COPY_AND_ASSIGN(OfflinePageModel); | 381 DISALLOW_COPY_AND_ASSIGN(OfflinePageModel); |
| 377 }; | 382 }; |
| 378 | 383 |
| 379 } // namespace offline_pages | 384 } // namespace offline_pages |
| 380 | 385 |
| 381 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_ | 386 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_ |
| OLD | NEW |