| 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. |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 std::vector<base::Closure> delayed_tasks_; | 331 std::vector<base::Closure> delayed_tasks_; |
| 340 | 332 |
| 341 base::WeakPtrFactory<OfflinePageModel> weak_ptr_factory_; | 333 base::WeakPtrFactory<OfflinePageModel> weak_ptr_factory_; |
| 342 | 334 |
| 343 DISALLOW_COPY_AND_ASSIGN(OfflinePageModel); | 335 DISALLOW_COPY_AND_ASSIGN(OfflinePageModel); |
| 344 }; | 336 }; |
| 345 | 337 |
| 346 } // namespace offline_pages | 338 } // namespace offline_pages |
| 347 | 339 |
| 348 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_ | 340 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_ |
| OLD | NEW |