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

Side by Side 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: 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 22 matching lines...) Expand all
33 class TimeDelta; 33 class TimeDelta;
34 } 34 }
35 35
36 namespace offline_pages { 36 namespace offline_pages {
37 37
38 static const char* const kBookmarkNamespace = "bookmark"; 38 static const char* const kBookmarkNamespace = "bookmark";
39 static const int64_t kInvalidOfflineId = 0; 39 static const int64_t kInvalidOfflineId = 0;
40 40
41 struct ClientId; 41 struct ClientId;
42 42
43 class ClientPolicyController;
43 struct OfflinePageItem; 44 struct OfflinePageItem;
44 class OfflinePageMetadataStore; 45 class OfflinePageMetadataStore;
46 class OfflinePageStorageManager;
45 47
46 // Service for saving pages offline, storing the offline copy and metadata, and 48 // Service for saving pages offline, storing the offline copy and metadata, and
47 // retrieving them upon request. 49 // retrieving them upon request.
48 // 50 //
49 // Example usage: 51 // Example usage:
50 // class ArchiverImpl : public OfflinePageArchiver { 52 // class ArchiverImpl : public OfflinePageArchiver {
51 // // This is a class that knows how to create archiver 53 // // This is a class that knows how to create archiver
52 // void CreateArchiver(...) override; 54 // void CreateArchiver(...) override;
53 // ... 55 // ...
54 // } 56 // }
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 // pages. Method is to be called after a page was saved or some pages are 252 // pages. Method is to be called after a page was saved or some pages are
251 // deleted. In the latter case |reporting_after_delete| is set to true. 253 // deleted. In the latter case |reporting_after_delete| is set to true.
252 // Caller is supposed to provide the current |total_space_bytes| on drive 254 // Caller is supposed to provide the current |total_space_bytes| on drive
253 // where the pages are stored, as well as |free_space_bytes| after the 255 // where the pages are stored, as well as |free_space_bytes| after the
254 // operation was taken. The method will report total size of all pages, and 256 // operation was taken. The method will report total size of all pages, and
255 // percentage of size of pages as compared to total space and free space. 257 // percentage of size of pages as compared to total space and free space.
256 void RecordStorageHistograms(int64_t total_space_bytes, 258 void RecordStorageHistograms(int64_t total_space_bytes,
257 int64_t free_space_bytes, 259 int64_t free_space_bytes,
258 bool reporting_after_delete); 260 bool reporting_after_delete);
259 261
262 // Returns the policy controller.
263 ClientPolicyController* GetPolicyController();
264
260 // Methods for testing only: 265 // Methods for testing only:
261 OfflinePageMetadataStore* GetStoreForTesting(); 266 OfflinePageMetadataStore* GetStoreForTesting();
262 267
268 OfflinePageStorageManager* GetStorageManager();
269
263 bool is_loaded() const { return is_loaded_; } 270 bool is_loaded() const { return is_loaded_; }
264 271
265 private: 272 private:
266 FRIEND_TEST_ALL_PREFIXES(OfflinePageModelTest, MarkPageForDeletion); 273 FRIEND_TEST_ALL_PREFIXES(OfflinePageModelTest, MarkPageForDeletion);
267 274
268 typedef ScopedVector<OfflinePageArchiver> PendingArchivers; 275 typedef ScopedVector<OfflinePageArchiver> PendingArchivers;
269 276
270 // Callback for ensuring archive directory is created. 277 // Callback for ensuring archive directory is created.
271 void OnEnsureArchivesDirCreatedDone(); 278 void OnEnsureArchivesDirCreatedDone();
272 279
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 std::map<int64_t, OfflinePageItem> offline_pages_; 381 std::map<int64_t, OfflinePageItem> offline_pages_;
375 382
376 scoped_refptr<base::SequencedTaskRunner> task_runner_; 383 scoped_refptr<base::SequencedTaskRunner> task_runner_;
377 384
378 // Pending archivers owned by this model. 385 // Pending archivers owned by this model.
379 PendingArchivers pending_archivers_; 386 PendingArchivers pending_archivers_;
380 387
381 // Delayed tasks that should be invoked after the loading is done. 388 // Delayed tasks that should be invoked after the loading is done.
382 std::vector<base::Closure> delayed_tasks_; 389 std::vector<base::Closure> delayed_tasks_;
383 390
391 // Controller of the client policies.
392 std::unique_ptr<ClientPolicyController> policy_controller_;
393
394 // Storage manager of this model.
fgorski 2016/05/05 04:53:08 I believe we will run into a problem of distinguis
romax 2016/05/05 21:00:02 Done.
395 std::unique_ptr<OfflinePageStorageManager> storage_manager_;
396
384 base::WeakPtrFactory<OfflinePageModel> weak_ptr_factory_; 397 base::WeakPtrFactory<OfflinePageModel> weak_ptr_factory_;
385 398
386 DISALLOW_COPY_AND_ASSIGN(OfflinePageModel); 399 DISALLOW_COPY_AND_ASSIGN(OfflinePageModel);
387 }; 400 };
388 401
389 } // namespace offline_pages 402 } // namespace offline_pages
390 403
391 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_ 404 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698