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

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

Issue 2041983006: [Offline Pages] Filtering expired pages and fix consistency check. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments and some naming changes. Created 4 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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 class Observer { 50 class Observer {
51 public: 51 public:
52 // Invoked when the model has finished loading. 52 // Invoked when the model has finished loading.
53 virtual void OfflinePageModelLoaded(OfflinePageModel* model) = 0; 53 virtual void OfflinePageModelLoaded(OfflinePageModel* model) = 0;
54 54
55 // Invoked when the model is being updated, due to adding, removing or 55 // Invoked when the model is being updated, due to adding, removing or
56 // updating an offline page. 56 // updating an offline page.
57 virtual void OfflinePageModelChanged(OfflinePageModel* model) = 0; 57 virtual void OfflinePageModelChanged(OfflinePageModel* model) = 0;
58 58
59 // Invoked when an offline copy related to |offline_id| was deleted. 59 // Invoked when an offline copy related to |offline_id| was deleted.
60 // In can be invoked as a result of |CheckForExternalFileDeletion|, if a
61 // deleted page is detected.
62 virtual void OfflinePageDeleted(int64_t offline_id, 60 virtual void OfflinePageDeleted(int64_t offline_id,
63 const ClientId& client_id) = 0; 61 const ClientId& client_id) = 0;
64 62
65 protected: 63 protected:
66 virtual ~Observer() = default; 64 virtual ~Observer() = default;
67 }; 65 };
68 66
69 using CheckPagesExistOfflineResult = 67 using CheckPagesExistOfflineResult =
70 offline_pages::CheckPagesExistOfflineResult; 68 offline_pages::CheckPagesExistOfflineResult;
71 using MultipleOfflinePageItemResult = 69 using MultipleOfflinePageItemResult =
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 // selection. 170 // selection.
173 virtual void GetBestPageForOnlineURL( 171 virtual void GetBestPageForOnlineURL(
174 const GURL& online_url, 172 const GURL& online_url,
175 const SingleOfflinePageItemCallback callback) = 0; 173 const SingleOfflinePageItemCallback callback) = 0;
176 174
177 // Returns an offline page saved for |online_url|. A nullptr is returned if 175 // Returns an offline page saved for |online_url|. A nullptr is returned if
178 // not found. See |GetBestPageForOnlineURL| for selection criteria. 176 // not found. See |GetBestPageForOnlineURL| for selection criteria.
179 virtual const OfflinePageItem* MaybeGetBestPageForOnlineURL( 177 virtual const OfflinePageItem* MaybeGetBestPageForOnlineURL(
180 const GURL& online_url) const = 0; 178 const GURL& online_url) const = 0;
181 179
182 // Checks that all of the offline pages have corresponding offline copies. 180 // Checks that all of the offline pages have corresponding offline copies,
181 // and all archived files have offline pages pointing to them.
183 // If a page is discovered to be missing an offline copy, its offline page 182 // If a page is discovered to be missing an offline copy, its offline page
184 // metadata will be removed and |OfflinePageDeleted| will be sent to model 183 // metadata will be expired. If an archive file is discovered missing its
185 // observers. 184 // offline page, it will be deleted.
186 virtual void CheckForExternalFileDeletion() = 0; 185 virtual void CheckMetadataConsistency() = 0;
187 186
188 // Marks pages with |offline_ids| as expired and deletes the associated 187 // Marks pages with |offline_ids| as expired and deletes the associated
189 // archive files. 188 // archive files.
190 virtual void ExpirePages(const std::vector<int64_t>& offline_ids, 189 virtual void ExpirePages(const std::vector<int64_t>& offline_ids,
191 const base::Time& expiration_time, 190 const base::Time& expiration_time,
192 const base::Callback<void(bool)>& callback) = 0; 191 const base::Callback<void(bool)>& callback) = 0;
193 192
194 // Returns the policy controller. 193 // Returns the policy controller.
195 virtual ClientPolicyController* GetPolicyController() = 0; 194 virtual ClientPolicyController* GetPolicyController() = 0;
196 195
197 // TODO(dougarnett): Remove this and its uses. 196 // TODO(dougarnett): Remove this and its uses.
198 virtual bool is_loaded() const = 0; 197 virtual bool is_loaded() const = 0;
199 }; 198 };
200 199
201 } // namespace offline_pages 200 } // namespace offline_pages
202 201
203 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_ 202 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698