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 <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
160 // Deletes an offline page related to the passed |bookmark_id|. Requires that | 160 // Deletes an offline page related to the passed |bookmark_id|. Requires that |
161 // the model is loaded. | 161 // the model is loaded. |
162 void DeletePageByBookmarkId(int64 bookmark_id, | 162 void DeletePageByBookmarkId(int64 bookmark_id, |
163 const DeletePageCallback& callback); | 163 const DeletePageCallback& callback); |
164 | 164 |
165 // Deletes offline pages related to the passed |bookmark_ids|. Requires that | 165 // Deletes offline pages related to the passed |bookmark_ids|. Requires that |
166 // the model is loaded. | 166 // the model is loaded. |
167 void DeletePagesByBookmarkId(const std::vector<int64>& bookmark_ids, | 167 void DeletePagesByBookmarkId(const std::vector<int64>& bookmark_ids, |
168 const DeletePageCallback& callback); | 168 const DeletePageCallback& callback); |
169 | 169 |
170 void UndeletePage(int64 bookmark_id, const DeletePageCallback& callback); | 170 // Remove all saved files and clear the store. |
171 void ClearAll(const base::Closure& callback); | |
fgorski
2015/10/23 20:55:03
DeleteAllPages -- to be consistent with the naming
jianli
2015/10/26 21:42:44
I think semantically ClearAll is a bit different f
fgorski
2015/10/27 20:13:09
Acknowledged.
| |
171 | 172 |
172 // Gets all available offline pages. Requires that the model is loaded. | 173 // Gets all available offline pages. Requires that the model is loaded. |
173 const std::vector<OfflinePageItem> GetAllPages() const; | 174 const std::vector<OfflinePageItem> GetAllPages() const; |
174 | 175 |
175 // Gets pages that should be removed to clean up storage. Requires that the | 176 // Gets pages that should be removed to clean up storage. Requires that the |
176 // model is loaded. | 177 // model is loaded. |
177 const std::vector<OfflinePageItem> GetPagesToCleanUp() const; | 178 const std::vector<OfflinePageItem> GetPagesToCleanUp() const; |
178 | 179 |
179 // Returns an offline page associated with a specified |bookmark_id|. nullptr | 180 // Returns an offline page associated with a specified |bookmark_id|. nullptr |
180 // is returned if not found. | 181 // is returned if not found. |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
256 void UndoPageDeletion(int64 bookmark_id); | 257 void UndoPageDeletion(int64 bookmark_id); |
257 void OnUndoOfflinePageDone(const OfflinePageItem& offline_page, bool success); | 258 void OnUndoOfflinePageDone(const OfflinePageItem& offline_page, bool success); |
258 | 259 |
259 // Callbacks for checking if offline pages are missing archive files. | 260 // Callbacks for checking if offline pages are missing archive files. |
260 void OnFindPagesMissingArchiveFile( | 261 void OnFindPagesMissingArchiveFile( |
261 const std::vector<int64>* pages_missing_archive_file); | 262 const std::vector<int64>* pages_missing_archive_file); |
262 void OnRemoveOfflinePagesMissingArchiveFileDone( | 263 void OnRemoveOfflinePagesMissingArchiveFileDone( |
263 const std::vector<int64>& bookmark_ids, | 264 const std::vector<int64>& bookmark_ids, |
264 OfflinePageModel::DeletePageResult result); | 265 OfflinePageModel::DeletePageResult result); |
265 | 266 |
267 // Steps for clearing all. | |
268 void OnRemoveAllFilesDoneForClearAll(const base::Closure& callback, | |
269 DeletePageResult result); | |
270 void OnResetStoreDoneForClearAll(const base::Closure& callback, bool success); | |
271 void OnReloadStoreDoneForClearAll( | |
272 const base::Closure& callback, | |
273 bool success, | |
274 const std::vector<OfflinePageItem>& offline_pages); | |
275 | |
276 void CacheLoadedData(const std::vector<OfflinePageItem>& offline_pages); | |
277 | |
266 // Persistent store for offline page metadata. | 278 // Persistent store for offline page metadata. |
267 scoped_ptr<OfflinePageMetadataStore> store_; | 279 scoped_ptr<OfflinePageMetadataStore> store_; |
268 | 280 |
269 // The observers. | 281 // The observers. |
270 base::ObserverList<Observer> observers_; | 282 base::ObserverList<Observer> observers_; |
271 | 283 |
272 bool is_loaded_; | 284 bool is_loaded_; |
273 | 285 |
274 // In memory copy of the offline page metadata, keyed by bookmark IDs. | 286 // In memory copy of the offline page metadata, keyed by bookmark IDs. |
275 std::map<int64, OfflinePageItem> offline_pages_; | 287 std::map<int64, OfflinePageItem> offline_pages_; |
(...skipping 10 matching lines...) Expand all Loading... | |
286 scoped_observer_; | 298 scoped_observer_; |
287 | 299 |
288 base::WeakPtrFactory<OfflinePageModel> weak_ptr_factory_; | 300 base::WeakPtrFactory<OfflinePageModel> weak_ptr_factory_; |
289 | 301 |
290 DISALLOW_COPY_AND_ASSIGN(OfflinePageModel); | 302 DISALLOW_COPY_AND_ASSIGN(OfflinePageModel); |
291 }; | 303 }; |
292 | 304 |
293 } // namespace offline_pages | 305 } // namespace offline_pages |
294 | 306 |
295 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_ | 307 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_ |
OLD | NEW |