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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 const DeletePageCallback& callback); | 167 const DeletePageCallback& callback); |
168 | 168 |
169 // Wipes out all the data by deleting all saved files and clearing the store. | 169 // Wipes out all the data by deleting all saved files and clearing the store. |
170 void ClearAll(const base::Closure& callback); | 170 void ClearAll(const base::Closure& callback); |
171 | 171 |
172 // Deletes offline pages matching the URL predicate. | 172 // Deletes offline pages matching the URL predicate. |
173 void DeletePagesByURLPredicate( | 173 void DeletePagesByURLPredicate( |
174 const base::Callback<bool(const GURL&)>& predicate, | 174 const base::Callback<bool(const GURL&)>& predicate, |
175 const DeletePageCallback& callback); | 175 const DeletePageCallback& callback); |
176 | 176 |
177 // Returns true if there are offline pages in the given |name_space|. This | |
178 // method is sync, so the result can be wrong depending on implementation | |
179 // details of the model. | |
180 // | |
181 // Currently, this will return |false| if the model is not loaded, even if | |
182 // there are pages on disk. | |
183 bool MaybeHasPages(const std::string& name_space) const; | |
184 | |
185 // Returns true via callback if there are offline pages in the given | 177 // Returns true via callback if there are offline pages in the given |
186 // |name_space|. | 178 // |name_space|. |
187 void HasPages(const std::string& name_space, | 179 void HasPages(const std::string& name_space, |
188 const HasPagesCallback& callback); | 180 const HasPagesCallback& callback); |
189 | 181 |
190 // Gets all available offline pages. Requires that the model is loaded. | 182 // Gets all available offline pages. Requires that the model is loaded. |
191 void GetAllPages(const GetAllPagesCallback& callback); | 183 void GetAllPages(const GetAllPagesCallback& callback); |
192 | 184 |
193 // Gets pages that should be removed to clean up storage. Requires that the | 185 // Gets pages that should be removed to clean up storage. Requires that the |
194 // model is loaded. | 186 // model is loaded. |
| 187 // TODO(fgorski): This needs an update as part of expiration policy work. |
195 const std::vector<OfflinePageItem> GetPagesToCleanUp() const; | 188 const std::vector<OfflinePageItem> GetPagesToCleanUp() const; |
196 | 189 |
197 // Gets all offline ids where the offline page has the matching client id | 190 // Gets all offline ids where the offline page has the matching client id |
198 // If |include_deleted| is true, include pages that are marked for deletion | 191 // If |include_deleted| is true, include pages that are marked for deletion |
199 // but not actually deleted yet. Default is false. | 192 // but not actually deleted yet. Default is false. |
200 const std::vector<int64_t> GetOfflineIdsForClientId( | 193 const std::vector<int64_t> GetOfflineIdsForClientId( |
201 const ClientId& client_id, | 194 const ClientId& client_id, |
202 bool include_deleted = false) const; | 195 bool include_deleted = false) const; |
203 | 196 |
204 // Returns an offline page associated with a specified |offline_id|. nullptr | 197 // Returns an offline page associated with a specified |offline_id|. nullptr |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 std::vector<base::Closure> delayed_tasks_; | 332 std::vector<base::Closure> delayed_tasks_; |
340 | 333 |
341 base::WeakPtrFactory<OfflinePageModel> weak_ptr_factory_; | 334 base::WeakPtrFactory<OfflinePageModel> weak_ptr_factory_; |
342 | 335 |
343 DISALLOW_COPY_AND_ASSIGN(OfflinePageModel); | 336 DISALLOW_COPY_AND_ASSIGN(OfflinePageModel); |
344 }; | 337 }; |
345 | 338 |
346 } // namespace offline_pages | 339 } // namespace offline_pages |
347 | 340 |
348 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_ | 341 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_ |
OLD | NEW |