OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_items_collection/core/throttled_offline_content_pro
vider.h" | 5 #include "components/offline_items_collection/core/throttled_offline_content_pro
vider.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 } | 70 } |
71 | 71 |
72 OfflineContentProvider::OfflineItemList | 72 OfflineContentProvider::OfflineItemList |
73 ThrottledOfflineContentProvider::GetAllItems() { | 73 ThrottledOfflineContentProvider::GetAllItems() { |
74 OfflineItemList items = wrapped_provider_->GetAllItems(); | 74 OfflineItemList items = wrapped_provider_->GetAllItems(); |
75 for (auto item : items) | 75 for (auto item : items) |
76 UpdateItemIfPresent(item); | 76 UpdateItemIfPresent(item); |
77 return items; | 77 return items; |
78 } | 78 } |
79 | 79 |
| 80 void ThrottledOfflineContentProvider::GetVisualsForItem( |
| 81 const ContentId& id, |
| 82 const VisualsCallback& callback) { |
| 83 wrapped_provider_->GetVisualsForItem(id, callback); |
| 84 } |
| 85 |
80 void ThrottledOfflineContentProvider::AddObserver( | 86 void ThrottledOfflineContentProvider::AddObserver( |
81 OfflineContentProvider::Observer* observer) { | 87 OfflineContentProvider::Observer* observer) { |
82 DCHECK(observer); | 88 DCHECK(observer); |
83 observers_.AddObserver(observer); | 89 observers_.AddObserver(observer); |
84 if (!wrapped_provider_->AreItemsAvailable()) | 90 if (!wrapped_provider_->AreItemsAvailable()) |
85 return; | 91 return; |
86 | 92 |
87 base::ThreadTaskRunnerHandle::Get()->PostTask( | 93 base::ThreadTaskRunnerHandle::Get()->PostTask( |
88 FROM_HERE, | 94 FROM_HERE, |
89 base::Bind(&ThrottledOfflineContentProvider::NotifyItemsAvailable, | 95 base::Bind(&ThrottledOfflineContentProvider::NotifyItemsAvailable, |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 update_queued_ = false; | 151 update_queued_ = false; |
146 | 152 |
147 OfflineItemMap updates = std::move(updates_); | 153 OfflineItemMap updates = std::move(updates_); |
148 for (auto item_pair : updates) { | 154 for (auto item_pair : updates) { |
149 for (auto& observer : observers_) | 155 for (auto& observer : observers_) |
150 observer.OnItemUpdated(item_pair.second); | 156 observer.OnItemUpdated(item_pair.second); |
151 } | 157 } |
152 } | 158 } |
153 | 159 |
154 } // namespace offline_items_collection | 160 } // namespace offline_items_collection |
OLD | NEW |