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

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

Issue 1160283003: [Offline] Creates metadata store interface for offline pages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@offline-pages-1
Patch Set: Addressing more feedback Created 5 years, 6 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 <vector> 8 #include <vector>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
11 #include "components/keyed_service/core/keyed_service.h" 12 #include "components/keyed_service/core/keyed_service.h"
12 13
13 class GURL; 14 class GURL;
14 15
15 namespace offline_pages { 16 namespace offline_pages {
16 17
17 struct OfflinePageItem; 18 struct OfflinePageItem;
19 class OfflinePageMetadataStore;
18 20
19 // Serivce for saving pages offline, storing the offline copy and metadata, and 21 // Serivce for saving pages offline, storing the offline copy and metadata, and
20 // retrieving them upon request. 22 // retrieving them upon request.
21 class OfflinePageModel : public KeyedService { 23 class OfflinePageModel : public KeyedService {
22 public: 24 public:
23 OfflinePageModel(); 25 explicit OfflinePageModel(scoped_ptr<OfflinePageMetadataStore> store);
24 ~OfflinePageModel() override; 26 ~OfflinePageModel() override;
25 27
26 // KeyedService: 28 // KeyedService:
27 void Shutdown() override; 29 void Shutdown() override;
28 30
29 // Saves the page loaded in the web contents offline. 31 // Saves the page loaded in the web contents offline.
30 void SavePageOffline(const GURL& url); 32 void SavePageOffline(const GURL& url);
31 33
32 // Gets a set of all offline pages metadata. 34 // Gets a set of all offline pages metadata.
33 std::vector<OfflinePageItem> GetAllOfflinePages(); 35 std::vector<OfflinePageItem> GetAllOfflinePages();
34 36
37 // Methods for testing only:
38 OfflinePageMetadataStore* GetStoreForTesting();
39
35 private: 40 private:
41 // Persistent store for offline page metadata.
42 scoped_ptr<OfflinePageMetadataStore> store_;
43
36 DISALLOW_COPY_AND_ASSIGN(OfflinePageModel); 44 DISALLOW_COPY_AND_ASSIGN(OfflinePageModel);
37 }; 45 };
38 46
39 } // namespace offline_pages 47 } // namespace offline_pages
40 48
41 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_ 49 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_
OLDNEW
« no previous file with comments | « components/offline_pages/offline_page_metadata_store.cc ('k') | components/offline_pages/offline_page_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698