| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 void AddObserver(Observer* observer); | 123 void AddObserver(Observer* observer); |
| 124 void RemoveObserver(Observer* observer); | 124 void RemoveObserver(Observer* observer); |
| 125 | 125 |
| 126 // Attempts to save a page addressed by |url| offline. Requires that the model | 126 // Attempts to save a page addressed by |url| offline. Requires that the model |
| 127 // is loaded. | 127 // is loaded. |
| 128 void SavePage(const GURL& url, | 128 void SavePage(const GURL& url, |
| 129 int64 bookmark_id, | 129 int64 bookmark_id, |
| 130 scoped_ptr<OfflinePageArchiver> archiver, | 130 scoped_ptr<OfflinePageArchiver> archiver, |
| 131 const SavePageCallback& callback); | 131 const SavePageCallback& callback); |
| 132 | 132 |
| 133 // Marks that the offline page related to the passed |bookmark_id| has been |
| 134 // accessed. Its access info, including last access time and access count, |
| 135 // will be updated. Requires that the model is loaded. |
| 136 void MarkPageAccessed(int64 bookmark_id); |
| 137 |
| 133 // Deletes an offline page related to the passed |bookmark_id|. Requires that | 138 // Deletes an offline page related to the passed |bookmark_id|. Requires that |
| 134 // the model is loaded. | 139 // the model is loaded. |
| 135 void DeletePageByBookmarkId(int64 bookmark_id, | 140 void DeletePageByBookmarkId(int64 bookmark_id, |
| 136 const DeletePageCallback& callback); | 141 const DeletePageCallback& callback); |
| 137 | 142 |
| 138 // Deletes offline pages related to the passed |bookmark_ids|. Requires that | 143 // Deletes offline pages related to the passed |bookmark_ids|. Requires that |
| 139 // the model is loaded. | 144 // the model is loaded. |
| 140 void DeletePagesByBookmarkId(const std::vector<int64>& bookmark_ids, | 145 void DeletePagesByBookmarkId(const std::vector<int64>& bookmark_ids, |
| 141 const DeletePageCallback& callback); | 146 const DeletePageCallback& callback); |
| 142 | 147 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 void OnDeleteArchiveFilesDone( | 201 void OnDeleteArchiveFilesDone( |
| 197 const std::vector<int64>& bookmark_ids, | 202 const std::vector<int64>& bookmark_ids, |
| 198 const DeletePageCallback& callback, | 203 const DeletePageCallback& callback, |
| 199 const bool* success); | 204 const bool* success); |
| 200 void OnRemoveOfflinePagesDone(const std::vector<int64>& bookmark_ids, | 205 void OnRemoveOfflinePagesDone(const std::vector<int64>& bookmark_ids, |
| 201 const DeletePageCallback& callback, | 206 const DeletePageCallback& callback, |
| 202 bool success); | 207 bool success); |
| 203 void InformDeletePageDone(const DeletePageCallback& callback, | 208 void InformDeletePageDone(const DeletePageCallback& callback, |
| 204 DeletePageResult result); | 209 DeletePageResult result); |
| 205 | 210 |
| 211 void OnUpdateOfflinePageDone(const OfflinePageItem& offline_page_item, |
| 212 bool success); |
| 213 |
| 206 // Persistent store for offline page metadata. | 214 // Persistent store for offline page metadata. |
| 207 scoped_ptr<OfflinePageMetadataStore> store_; | 215 scoped_ptr<OfflinePageMetadataStore> store_; |
| 208 | 216 |
| 209 // The observers. | 217 // The observers. |
| 210 base::ObserverList<Observer> observers_; | 218 base::ObserverList<Observer> observers_; |
| 211 | 219 |
| 212 bool is_loaded_; | 220 bool is_loaded_; |
| 213 | 221 |
| 214 // In memory copy of the offline page metadata, keyed by bookmark IDs. | 222 // In memory copy of the offline page metadata, keyed by bookmark IDs. |
| 215 std::map<int64, OfflinePageItem> offline_pages_; | 223 std::map<int64, OfflinePageItem> offline_pages_; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 226 scoped_observer_; | 234 scoped_observer_; |
| 227 | 235 |
| 228 base::WeakPtrFactory<OfflinePageModel> weak_ptr_factory_; | 236 base::WeakPtrFactory<OfflinePageModel> weak_ptr_factory_; |
| 229 | 237 |
| 230 DISALLOW_COPY_AND_ASSIGN(OfflinePageModel); | 238 DISALLOW_COPY_AND_ASSIGN(OfflinePageModel); |
| 231 }; | 239 }; |
| 232 | 240 |
| 233 } // namespace offline_pages | 241 } // namespace offline_pages |
| 234 | 242 |
| 235 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_ | 243 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_ |
| OLD | NEW |