Chromium Code Reviews| Index: components/offline_pages/offline_page_model.cc |
| diff --git a/components/offline_pages/offline_page_model.cc b/components/offline_pages/offline_page_model.cc |
| index e89ae2add15ad730c64a7120bfad6fc60eb214cc..b45bfbaec20e30f894c0d44b0ecb8f9084fc931b 100644 |
| --- a/components/offline_pages/offline_page_model.cc |
| +++ b/components/offline_pages/offline_page_model.cc |
| @@ -22,6 +22,8 @@ namespace offline_pages { |
| namespace { |
| +const base::TimeDelta OLD_PAGE_INTERVAL = base::TimeDelta::FromDays(30); |
|
jianli
2015/08/21 21:06:27
We should use C++ style constant here. Also it is
fgorski
2015/08/21 22:09:39
Done.
|
| + |
| SavePageResult ToSavePageResult(ArchiverResult archiver_result) { |
| SavePageResult result; |
| switch (archiver_result) { |
| @@ -141,6 +143,16 @@ const std::vector<OfflinePageItem> OfflinePageModel::GetAllPages() const { |
| return offline_pages; |
| } |
| +const std::vector<OfflinePageItem> OfflinePageModel::GetPagesToCleanUp() const { |
| + DCHECK(is_loaded_); |
| + std::vector<OfflinePageItem> offline_pages; |
| + for (const auto& id_page : offline_pages_) { |
| + if (base::Time::Now() - id_page.second.creation_time > OLD_PAGE_INTERVAL) |
| + offline_pages.push_back(id_page.second); |
|
jianli
2015/08/21 21:06:27
nit: it is better to store Now time before for loo
fgorski
2015/08/21 22:09:39
Done.
|
| + } |
| + return offline_pages; |
| +} |
| + |
| bool OfflinePageModel::GetPageByBookmarkId( |
| int64 bookmark_id, |
| OfflinePageItem* offline_page) const { |