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

Side by Side Diff: components/offline_pages/offline_page_model.h

Issue 1981093002: [Offline pages] Hooking up Archive Manager to Offline Page Model (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@archive-manager
Patch Set: Fixing the windows bot 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 unified diff | Download patch
OLDNEW
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 24 matching lines...) Expand all
35 class TimeDelta; 35 class TimeDelta;
36 class TimeTicks; 36 class TimeTicks;
37 } // namespace base 37 } // namespace base
38 38
39 namespace offline_pages { 39 namespace offline_pages {
40 40
41 static const char* const kBookmarkNamespace = "bookmark"; 41 static const char* const kBookmarkNamespace = "bookmark";
42 static const int64_t kInvalidOfflineId = 0; 42 static const int64_t kInvalidOfflineId = 0;
43 43
44 struct ClientId; 44 struct ClientId;
45 struct OfflinePageItem;
45 46
47 class ArchiveManager;
46 class ClientPolicyController; 48 class ClientPolicyController;
47 struct OfflinePageItem;
48 class OfflinePageMetadataStore; 49 class OfflinePageMetadataStore;
49 class OfflinePageStorageManager; 50 class OfflinePageStorageManager;
50 51
51 // Service for saving pages offline, storing the offline copy and metadata, and 52 // Service for saving pages offline, storing the offline copy and metadata, and
52 // retrieving them upon request. 53 // retrieving them upon request.
53 // 54 //
54 // Example usage: 55 // Example usage:
55 // class ArchiverImpl : public OfflinePageArchiver { 56 // class ArchiverImpl : public OfflinePageArchiver {
56 // // This is a class that knows how to create archiver 57 // // This is a class that knows how to create archiver
57 // void CreateArchiver(...) override; 58 // void CreateArchiver(...) override;
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 bool success); 294 bool success);
294 void InformSavePageDone(const SavePageCallback& callback, 295 void InformSavePageDone(const SavePageCallback& callback,
295 SavePageResult result, 296 SavePageResult result,
296 const ClientId& client_id, 297 const ClientId& client_id,
297 int64_t offline_id); 298 int64_t offline_id);
298 void DeletePendingArchiver(OfflinePageArchiver* archiver); 299 void DeletePendingArchiver(OfflinePageArchiver* archiver);
299 300
300 // Steps for deleting files and data for an offline page. 301 // Steps for deleting files and data for an offline page.
301 void OnDeleteArchiveFilesDone(const std::vector<int64_t>& offline_ids, 302 void OnDeleteArchiveFilesDone(const std::vector<int64_t>& offline_ids,
302 const DeletePageCallback& callback, 303 const DeletePageCallback& callback,
303 const bool* success); 304 bool success);
304 void OnRemoveOfflinePagesDone(const std::vector<int64_t>& offline_ids, 305 void OnRemoveOfflinePagesDone(const std::vector<int64_t>& offline_ids,
305 const DeletePageCallback& callback, 306 const DeletePageCallback& callback,
306 bool success); 307 bool success);
307 void InformDeletePageDone(const DeletePageCallback& callback, 308 void InformDeletePageDone(const DeletePageCallback& callback,
308 DeletePageResult result); 309 DeletePageResult result);
309 310
310 void OnMarkPageAccesseDone(const OfflinePageItem& offline_page_item, 311 void OnMarkPageAccesseDone(const OfflinePageItem& offline_page_item,
311 bool success); 312 bool success);
312 313
313 // Callbacks for checking if offline pages are missing archive files. 314 // Callbacks for checking if offline pages are missing archive files.
314 void OnFindPagesMissingArchiveFile( 315 void ScanForMissingArchiveFiles(
315 const std::vector<int64_t>* ids_of_pages_missing_archive_file); 316 const std::set<base::FilePath>& archive_paths);
316 void OnRemoveOfflinePagesMissingArchiveFileDone( 317 void OnRemoveOfflinePagesMissingArchiveFileDone(
317 const std::vector<std::pair<int64_t, ClientId>>& offline_client_id_pairs, 318 const std::vector<std::pair<int64_t, ClientId>>& offline_client_id_pairs,
318 DeletePageResult result); 319 DeletePageResult result);
319 320
320 // Steps for clearing all. 321 // Steps for clearing all.
321 void OnRemoveAllFilesDoneForClearAll(const base::Closure& callback, 322 void OnRemoveAllFilesDoneForClearAll(const base::Closure& callback,
322 DeletePageResult result); 323 DeletePageResult result);
323 void OnResetStoreDoneForClearAll(const base::Closure& callback, bool success); 324 void OnResetStoreDoneForClearAll(const base::Closure& callback, bool success);
324 void OnReloadStoreDoneForClearAll( 325 void OnReloadStoreDoneForClearAll(
325 const base::Closure& callback, 326 const base::Closure& callback,
(...skipping 20 matching lines...) Expand all
346 base::FilePath archives_dir_; 347 base::FilePath archives_dir_;
347 348
348 // The observers. 349 // The observers.
349 base::ObserverList<Observer> observers_; 350 base::ObserverList<Observer> observers_;
350 351
351 bool is_loaded_; 352 bool is_loaded_;
352 353
353 // In memory copy of the offline page metadata, keyed by bookmark IDs. 354 // In memory copy of the offline page metadata, keyed by bookmark IDs.
354 std::map<int64_t, OfflinePageItem> offline_pages_; 355 std::map<int64_t, OfflinePageItem> offline_pages_;
355 356
356 scoped_refptr<base::SequencedTaskRunner> task_runner_;
357
358 // Pending archivers owned by this model. 357 // Pending archivers owned by this model.
359 PendingArchivers pending_archivers_; 358 PendingArchivers pending_archivers_;
360 359
361 // Delayed tasks that should be invoked after the loading is done. 360 // Delayed tasks that should be invoked after the loading is done.
362 std::vector<base::Closure> delayed_tasks_; 361 std::vector<base::Closure> delayed_tasks_;
363 362
364 // Controller of the client policies. 363 // Controller of the client policies.
365 std::unique_ptr<ClientPolicyController> policy_controller_; 364 std::unique_ptr<ClientPolicyController> policy_controller_;
366 365
367 // Manager for the storage consumed by archives and responsible for 366 // Manager for the storage consumed by archives and responsible for
368 // automatic page clearing. 367 // automatic page clearing.
369 std::unique_ptr<OfflinePageStorageManager> storage_manager_; 368 std::unique_ptr<OfflinePageStorageManager> storage_manager_;
370 369
370 // Manager for the offline archive files and directory.
371 std::unique_ptr<ArchiveManager> archive_manager_;
372
371 base::WeakPtrFactory<OfflinePageModel> weak_ptr_factory_; 373 base::WeakPtrFactory<OfflinePageModel> weak_ptr_factory_;
372 374
373 DISALLOW_COPY_AND_ASSIGN(OfflinePageModel); 375 DISALLOW_COPY_AND_ASSIGN(OfflinePageModel);
374 }; 376 };
375 377
376 } // namespace offline_pages 378 } // namespace offline_pages
377 379
378 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_ 380 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_
OLDNEW
« no previous file with comments | « components/offline_pages/archive_manager_unittest.cc ('k') | components/offline_pages/offline_page_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698