Chromium Code Reviews| 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 235 // This function is deprecated, and may return |nullptr| even if a page | 235 // This function is deprecated, and may return |nullptr| even if a page |
| 236 // exists, depending on the implementation details of OfflinePageModel. | 236 // exists, depending on the implementation details of OfflinePageModel. |
| 237 // Use |GetPageByOfflineURL| instead. | 237 // Use |GetPageByOfflineURL| instead. |
| 238 const OfflinePageItem* MaybeGetPageByOfflineURL( | 238 const OfflinePageItem* MaybeGetPageByOfflineURL( |
| 239 const GURL& offline_url) const; | 239 const GURL& offline_url) const; |
| 240 | 240 |
| 241 // Returns the offline pages that are stored under |online_url|. | 241 // Returns the offline pages that are stored under |online_url|. |
| 242 void GetPagesByOnlineURL(const GURL& online_url, | 242 void GetPagesByOnlineURL(const GURL& online_url, |
| 243 const MultipleOfflinePageItemCallback& callback); | 243 const MultipleOfflinePageItemCallback& callback); |
| 244 | 244 |
| 245 // Returns via callback an offline page saved for |online_url|, if any. The | |
| 246 // best page is chosen based on creation date; a more recently created offline | |
| 247 // page will be preferred over an older one. This API function does not | |
|
fgorski
2016/05/10 20:52:53
nit: Be consistent with usage of double space afte
dewittj
2016/05/11 15:57:25
Done.
| |
| 248 // respect namespaces, as it is used to choose which page is rendered in a | |
| 249 // tab. Today all namespaces are treated equally for the purposes of this | |
| 250 // selection. | |
| 251 void GetBestPageForOnlineURL(const GURL& online_url, | |
| 252 const SingleOfflinePageItemCallback callback); | |
| 253 | |
| 245 // Returns an offline page saved for |online_url|. A nullptr is returned if | 254 // Returns an offline page saved for |online_url|. A nullptr is returned if |
| 246 // not found. | 255 // not found. The best page is chosen based on creation date; a more recently |
|
fgorski
2016/05/10 20:52:53
Simply:
See |GetBestPAge..| for selection of best
dewittj
2016/05/11 15:57:25
Done.
| |
| 247 const OfflinePageItem* MaybeGetPageByOnlineURL(const GURL& online_url) const; | 256 // created offline page will be preferred over an older one. This API |
| 257 // function does not respect namespaces, as it is used to choose which page is | |
| 258 // rendered in a tab. Today all namespaces are treated equally for the | |
| 259 // purposes of this selection. | |
| 260 const OfflinePageItem* MaybeGetBestPageForOnlineURL( | |
| 261 const GURL& online_url) const; | |
| 248 | 262 |
| 249 // Checks that all of the offline pages have corresponding offline copies. | 263 // Checks that all of the offline pages have corresponding offline copies. |
| 250 // If a page is discovered to be missing an offline copy, its offline page | 264 // If a page is discovered to be missing an offline copy, its offline page |
| 251 // metadata will be removed and |OfflinePageDeleted| will be sent to model | 265 // metadata will be removed and |OfflinePageDeleted| will be sent to model |
| 252 // observers. | 266 // observers. |
| 253 void CheckForExternalFileDeletion(); | 267 void CheckForExternalFileDeletion(); |
| 254 | 268 |
| 255 // Reports the storage histograms related to total size of all stored offline | 269 // Reports the storage histograms related to total size of all stored offline |
| 256 // pages. Method is to be called after a page was saved or some pages are | 270 // pages. Method is to be called after a page was saved or some pages are |
| 257 // deleted. In the latter case |reporting_after_delete| is set to true. | 271 // deleted. In the latter case |reporting_after_delete| is set to true. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 298 const MultipleOfflineIdCallback& callback) const; | 312 const MultipleOfflineIdCallback& callback) const; |
| 299 void GetPageByOfflineIdWhenLoadDone( | 313 void GetPageByOfflineIdWhenLoadDone( |
| 300 int64_t offline_id, | 314 int64_t offline_id, |
| 301 const SingleOfflinePageItemCallback& callback) const; | 315 const SingleOfflinePageItemCallback& callback) const; |
| 302 void GetPagesByOnlineURLWhenLoadDone( | 316 void GetPagesByOnlineURLWhenLoadDone( |
| 303 const GURL& offline_url, | 317 const GURL& offline_url, |
| 304 const MultipleOfflinePageItemCallback& callback) const; | 318 const MultipleOfflinePageItemCallback& callback) const; |
| 305 void GetPageByOfflineURLWhenLoadDone( | 319 void GetPageByOfflineURLWhenLoadDone( |
| 306 const GURL& offline_url, | 320 const GURL& offline_url, |
| 307 const SingleOfflinePageItemCallback& callback) const; | 321 const SingleOfflinePageItemCallback& callback) const; |
| 322 void GetBestPageForOnlineURLWhenLoadDone( | |
| 323 const GURL& online_url, | |
| 324 const SingleOfflinePageItemCallback& callback) const; | |
| 308 | 325 |
| 309 // Callback for checking whether we have offline pages. | 326 // Callback for checking whether we have offline pages. |
| 310 void HasPagesAfterLoadDone(const std::string& name_space, | 327 void HasPagesAfterLoadDone(const std::string& name_space, |
| 311 const HasPagesCallback& callback) const; | 328 const HasPagesCallback& callback) const; |
| 312 | 329 |
| 313 // Callback for loading pages from the offline page metadata store. | 330 // Callback for loading pages from the offline page metadata store. |
| 314 void OnLoadDone(const base::TimeTicks& start_time, | 331 void OnLoadDone(const base::TimeTicks& start_time, |
| 315 OfflinePageMetadataStore::LoadStatus load_status, | 332 OfflinePageMetadataStore::LoadStatus load_status, |
| 316 const std::vector<OfflinePageItem>& offline_pages); | 333 const std::vector<OfflinePageItem>& offline_pages); |
| 317 | 334 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 408 std::unique_ptr<OfflinePageStorageManager> storage_manager_; | 425 std::unique_ptr<OfflinePageStorageManager> storage_manager_; |
| 409 | 426 |
| 410 base::WeakPtrFactory<OfflinePageModel> weak_ptr_factory_; | 427 base::WeakPtrFactory<OfflinePageModel> weak_ptr_factory_; |
| 411 | 428 |
| 412 DISALLOW_COPY_AND_ASSIGN(OfflinePageModel); | 429 DISALLOW_COPY_AND_ASSIGN(OfflinePageModel); |
| 413 }; | 430 }; |
| 414 | 431 |
| 415 } // namespace offline_pages | 432 } // namespace offline_pages |
| 416 | 433 |
| 417 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_ | 434 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_ |
| OLD | NEW |