| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "components/offline_pages/offline_page_model_impl.h" | 5 #include "components/offline_pages/offline_page_model_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1061 } | 1061 } |
| 1062 | 1062 |
| 1063 void OfflinePageModelImpl::PostClearStorageIfNeededTask() { | 1063 void OfflinePageModelImpl::PostClearStorageIfNeededTask() { |
| 1064 base::ThreadTaskRunnerHandle::Get()->PostTask( | 1064 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 1065 FROM_HERE, base::Bind(&OfflinePageModelImpl::ClearStorageIfNeeded, | 1065 FROM_HERE, base::Bind(&OfflinePageModelImpl::ClearStorageIfNeeded, |
| 1066 weak_ptr_factory_.GetWeakPtr(), | 1066 weak_ptr_factory_.GetWeakPtr(), |
| 1067 base::Bind(&OfflinePageModelImpl::OnStorageCleared, | 1067 base::Bind(&OfflinePageModelImpl::OnStorageCleared, |
| 1068 weak_ptr_factory_.GetWeakPtr()))); | 1068 weak_ptr_factory_.GetWeakPtr()))); |
| 1069 } | 1069 } |
| 1070 | 1070 |
| 1071 void OfflinePageModelImpl::BookmarkNodeRemoved( |
| 1072 bookmarks::BookmarkModel* model, |
| 1073 const bookmarks::BookmarkNode* parent, |
| 1074 int old_index, |
| 1075 const bookmarks::BookmarkNode* node, |
| 1076 const std::set<GURL>& no_longer_bookmarked) { |
| 1077 ClientId client_id(kBookmarkNamespace, std::to_string(node->id())); |
| 1078 GetOfflineIdsForClientId( |
| 1079 client_id, base::Bind(&OfflinePageModelImpl::ExpireRemovedBookmarkPages, |
| 1080 weak_ptr_factory_.GetWeakPtr())); |
| 1081 } |
| 1082 |
| 1083 void OfflinePageModelImpl::ExpireRemovedBookmarkPages( |
| 1084 const std::vector<int64_t>& offline_ids) { |
| 1085 ExpirePages(offline_ids, base::Time::Now(), |
| 1086 base::Bind(&OfflinePageModelImpl::OnRemovedBookmarkPagesExpired, |
| 1087 weak_ptr_factory_.GetWeakPtr())); |
| 1088 } |
| 1089 |
| 1090 void OfflinePageModelImpl::OnRemovedBookmarkPagesExpired(bool result) {} |
| 1091 |
| 1071 void OfflinePageModelImpl::RunWhenLoaded(const base::Closure& task) { | 1092 void OfflinePageModelImpl::RunWhenLoaded(const base::Closure& task) { |
| 1072 if (!is_loaded_) { | 1093 if (!is_loaded_) { |
| 1073 delayed_tasks_.push_back(task); | 1094 delayed_tasks_.push_back(task); |
| 1074 return; | 1095 return; |
| 1075 } | 1096 } |
| 1076 | 1097 |
| 1077 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task); | 1098 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task); |
| 1078 } | 1099 } |
| 1079 | 1100 |
| 1080 } // namespace offline_pages | 1101 } // namespace offline_pages |
| OLD | NEW |