| 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/ntp_snippets/offline_pages/offline_page_proxy.h" | 5 #include "components/ntp_snippets/offline_pages/offline_page_proxy.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 | 8 |
| 9 using offline_pages::MultipleOfflinePageItemResult; | 9 using offline_pages::MultipleOfflinePageItemResult; |
| 10 using offline_pages::MultipleOfflinePageItemCallback; | 10 using offline_pages::MultipleOfflinePageItemCallback; |
| 11 using offline_pages::OfflinePageModel; | 11 using offline_pages::OfflinePageModel; |
| 12 using offline_pages::OfflinePageItem; | |
| 13 | 12 |
| 14 namespace ntp_snippets { | 13 namespace ntp_snippets { |
| 15 | 14 |
| 16 OfflinePageProxy::OfflinePageProxy(OfflinePageModel* offline_page_model) | 15 OfflinePageProxy::OfflinePageProxy(OfflinePageModel* offline_page_model) |
| 17 : offline_page_model_(offline_page_model), weak_ptr_factory_(this) { | 16 : offline_page_model_(offline_page_model), weak_ptr_factory_(this) { |
| 18 offline_page_model_->AddObserver(this); | 17 offline_page_model_->AddObserver(this); |
| 19 } | 18 } |
| 20 | 19 |
| 21 void OfflinePageProxy::GetAllPages( | 20 void OfflinePageProxy::GetAllPages( |
| 22 const MultipleOfflinePageItemCallback& callback) { | 21 const MultipleOfflinePageItemCallback& callback) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 offline_page_model_->GetAllPages(base::Bind( | 57 offline_page_model_->GetAllPages(base::Bind( |
| 59 &OfflinePageProxy::OnOfflinePagesLoaded, weak_ptr_factory_.GetWeakPtr())); | 58 &OfflinePageProxy::OnOfflinePagesLoaded, weak_ptr_factory_.GetWeakPtr())); |
| 60 } | 59 } |
| 61 | 60 |
| 62 void OfflinePageProxy::OnOfflinePagesLoaded( | 61 void OfflinePageProxy::OnOfflinePagesLoaded( |
| 63 const MultipleOfflinePageItemResult& result) { | 62 const MultipleOfflinePageItemResult& result) { |
| 64 FOR_EACH_OBSERVER(Observer, observers_, OfflinePageModelChanged(result)); | 63 FOR_EACH_OBSERVER(Observer, observers_, OfflinePageModelChanged(result)); |
| 65 } | 64 } |
| 66 | 65 |
| 67 } // namespace ntp_snippets | 66 } // namespace ntp_snippets |
| OLD | NEW |