Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: components/ntp_snippets/offline_pages/offline_page_proxy.cc

Issue 2444753002: Reduce usage of FOR_EACH_OBSERVER macro in components/ (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 } 42 }
43 43
44 void OfflinePageProxy::OfflinePageModelChanged(OfflinePageModel* model) { 44 void OfflinePageProxy::OfflinePageModelChanged(OfflinePageModel* model) {
45 DCHECK_EQ(offline_page_model_, model); 45 DCHECK_EQ(offline_page_model_, model);
46 FetchOfflinePagesAndNotify(); 46 FetchOfflinePagesAndNotify();
47 } 47 }
48 48
49 void OfflinePageProxy::OfflinePageDeleted( 49 void OfflinePageProxy::OfflinePageDeleted(
50 int64_t offline_id, 50 int64_t offline_id,
51 const offline_pages::ClientId& client_id) { 51 const offline_pages::ClientId& client_id) {
52 FOR_EACH_OBSERVER(Observer, observers_, 52 for (Observer& observer : observers_)
53 OfflinePageDeleted(offline_id, client_id)); 53 observer.OfflinePageDeleted(offline_id, client_id);
54 } 54 }
55 55
56 void OfflinePageProxy::FetchOfflinePagesAndNotify() { 56 void OfflinePageProxy::FetchOfflinePagesAndNotify() {
57 offline_page_model_->GetAllPages(base::Bind( 57 offline_page_model_->GetAllPages(base::Bind(
58 &OfflinePageProxy::OnOfflinePagesLoaded, weak_ptr_factory_.GetWeakPtr())); 58 &OfflinePageProxy::OnOfflinePagesLoaded, weak_ptr_factory_.GetWeakPtr()));
59 } 59 }
60 60
61 void OfflinePageProxy::OnOfflinePagesLoaded( 61 void OfflinePageProxy::OnOfflinePagesLoaded(
62 const MultipleOfflinePageItemResult& result) { 62 const MultipleOfflinePageItemResult& result) {
63 FOR_EACH_OBSERVER(Observer, observers_, OfflinePageModelChanged(result)); 63 for (Observer& observer : observers_)
64 observer.OfflinePageModelChanged(result);
64 } 65 }
65 66
66 } // namespace ntp_snippets 67 } // namespace ntp_snippets
OLDNEW
« no previous file with comments | « components/ntp_snippets/content_suggestions_service.cc ('k') | components/offline_pages/background/request_coordinator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698