| 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 <memory> | 10 #include <memory> |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 // exists, depending on the implementation details of OfflinePageModel. | 158 // exists, depending on the implementation details of OfflinePageModel. |
| 159 // Use |GetPageByOfflineURL| instead. | 159 // Use |GetPageByOfflineURL| instead. |
| 160 virtual const OfflinePageItem* MaybeGetPageByOfflineURL( | 160 virtual const OfflinePageItem* MaybeGetPageByOfflineURL( |
| 161 const GURL& offline_url) const = 0; | 161 const GURL& offline_url) const = 0; |
| 162 | 162 |
| 163 // Returns the offline pages that are stored under |online_url|. | 163 // Returns the offline pages that are stored under |online_url|. |
| 164 virtual void GetPagesByOnlineURL( | 164 virtual void GetPagesByOnlineURL( |
| 165 const GURL& online_url, | 165 const GURL& online_url, |
| 166 const MultipleOfflinePageItemCallback& callback) = 0; | 166 const MultipleOfflinePageItemCallback& callback) = 0; |
| 167 | 167 |
| 168 // Returns via callback an offline page saved for |online_url|, if any. The | |
| 169 // best page is chosen based on creation date; a more recently created offline | |
| 170 // page will be preferred over an older one. This API function does not | |
| 171 // respect namespaces, as it is used to choose which page is rendered in a | |
| 172 // tab. Today all namespaces are treated equally for the purposes of this | |
| 173 // selection. | |
| 174 virtual void GetBestPageForOnlineURL( | |
| 175 const GURL& online_url, | |
| 176 const SingleOfflinePageItemCallback callback) = 0; | |
| 177 | |
| 178 // Returns an offline page saved for |online_url|. A nullptr is returned if | 168 // Returns an offline page saved for |online_url|. A nullptr is returned if |
| 179 // not found. See |GetBestPageForOnlineURL| for selection criteria. | 169 // not found. See |GetBestPageForOnlineURL| for selection criteria. |
| 180 virtual const OfflinePageItem* MaybeGetBestPageForOnlineURL( | 170 virtual const OfflinePageItem* MaybeGetBestPageForOnlineURL( |
| 181 const GURL& online_url) const = 0; | 171 const GURL& online_url) const = 0; |
| 182 | 172 |
| 183 // Checks that all of the offline pages have corresponding offline copies, | 173 // Checks that all of the offline pages have corresponding offline copies, |
| 184 // and all archived files have offline pages pointing to them. | 174 // and all archived files have offline pages pointing to them. |
| 185 // If a page is discovered to be missing an offline copy, its offline page | 175 // If a page is discovered to be missing an offline copy, its offline page |
| 186 // metadata will be expired. If an archive file is discovered missing its | 176 // metadata will be expired. If an archive file is discovered missing its |
| 187 // offline page, it will be deleted. | 177 // offline page, it will be deleted. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 199 // TODO(dougarnett): Remove this and its uses. | 189 // TODO(dougarnett): Remove this and its uses. |
| 200 virtual bool is_loaded() const = 0; | 190 virtual bool is_loaded() const = 0; |
| 201 | 191 |
| 202 // Returns the logger. Ownership is retained by the model. | 192 // Returns the logger. Ownership is retained by the model. |
| 203 virtual OfflineEventLogger* GetLogger() = 0; | 193 virtual OfflineEventLogger* GetLogger() = 0; |
| 204 }; | 194 }; |
| 205 | 195 |
| 206 } // namespace offline_pages | 196 } // namespace offline_pages |
| 207 | 197 |
| 208 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_ | 198 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_ |
| OLD | NEW |