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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 208 // not found. See |GetBestPageForOnlineURL| for selection criteria. | 208 // not found. See |GetBestPageForOnlineURL| for selection criteria. |
| 209 const OfflinePageItem* MaybeGetBestPageForOnlineURL( | 209 const OfflinePageItem* MaybeGetBestPageForOnlineURL( |
| 210 const GURL& online_url) const; | 210 const GURL& online_url) const; |
| 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 | |
| 219 // directory. | |
| 220 void ExpirePages(const std::vector<int64_t>& offline_ids, | |
| 221 base::Time expiration_time); | |
|
jianli
2016/05/19 20:39:54
nit: const &
fgorski
2016/05/20 17:54:23
Done.
| |
| 222 | |
| 218 // Returns the policy controller. | 223 // Returns the policy controller. |
| 219 ClientPolicyController* GetPolicyController(); | 224 ClientPolicyController* GetPolicyController(); |
| 220 | 225 |
| 221 // Methods for testing only: | 226 // Methods for testing only: |
| 222 OfflinePageMetadataStore* GetStoreForTesting(); | 227 OfflinePageMetadataStore* GetStoreForTesting(); |
| 223 | 228 |
| 224 OfflinePageStorageManager* GetStorageManager(); | 229 OfflinePageStorageManager* GetStorageManager(); |
| 225 | 230 |
| 226 bool is_loaded() const; | 231 bool is_loaded() const; |
| 227 | 232 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 322 | 327 |
| 323 // Actually does the work of deleting, requires the model is loaded. | 328 // Actually does the work of deleting, requires the model is loaded. |
| 324 void DoDeletePagesByOfflineId(const std::vector<int64_t>& offline_ids, | 329 void DoDeletePagesByOfflineId(const std::vector<int64_t>& offline_ids, |
| 325 const DeletePageCallback& callback); | 330 const DeletePageCallback& callback); |
| 326 | 331 |
| 327 // Similar to DoDeletePagesByOfflineId, does actual work of deleting, and | 332 // Similar to DoDeletePagesByOfflineId, does actual work of deleting, and |
| 328 // requires that the model is loaded. | 333 // requires that the model is loaded. |
| 329 void DoDeletePagesByURLPredicate(const UrlPredicate& predicate, | 334 void DoDeletePagesByURLPredicate(const UrlPredicate& predicate, |
| 330 const DeletePageCallback& callback); | 335 const DeletePageCallback& callback); |
| 331 | 336 |
| 337 // Callback completing page expiration. | |
| 338 void OnExpirePageDone(int64_t offline_id, | |
| 339 base::Time expiration_time, | |
|
jianli
2016/05/19 20:39:54
nit: ditto
fgorski
2016/05/20 17:54:23
Done.
| |
| 340 bool success); | |
| 341 | |
| 332 void RunWhenLoaded(const base::Closure& job); | 342 void RunWhenLoaded(const base::Closure& job); |
| 333 | 343 |
| 334 // Persistent store for offline page metadata. | 344 // Persistent store for offline page metadata. |
| 335 std::unique_ptr<OfflinePageMetadataStore> store_; | 345 std::unique_ptr<OfflinePageMetadataStore> store_; |
| 336 | 346 |
| 337 // Location where all of the archive files will be stored. | 347 // Location where all of the archive files will be stored. |
| 338 base::FilePath archives_dir_; | 348 base::FilePath archives_dir_; |
| 339 | 349 |
| 340 // The observers. | 350 // The observers. |
| 341 base::ObserverList<Observer> observers_; | 351 base::ObserverList<Observer> observers_; |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 362 std::unique_ptr<ArchiveManager> archive_manager_; | 372 std::unique_ptr<ArchiveManager> archive_manager_; |
| 363 | 373 |
| 364 base::WeakPtrFactory<OfflinePageModel> weak_ptr_factory_; | 374 base::WeakPtrFactory<OfflinePageModel> weak_ptr_factory_; |
| 365 | 375 |
| 366 DISALLOW_COPY_AND_ASSIGN(OfflinePageModel); | 376 DISALLOW_COPY_AND_ASSIGN(OfflinePageModel); |
| 367 }; | 377 }; |
| 368 | 378 |
| 369 } // namespace offline_pages | 379 } // namespace offline_pages |
| 370 | 380 |
| 371 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_ | 381 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_ |
| OLD | NEW |