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

Side by Side Diff: chrome/browser/ntp_snippets/download_suggestions_provider.cc

Issue 2469933002: Offline Pages: Replace Observer::OfflinePageModelChanged with OfflinePageAdded. (Closed)
Patch Set: nits Created 4 years 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 "chrome/browser/ntp_snippets/download_suggestions_provider.h" 5 #include "chrome/browser/ntp_snippets/download_suggestions_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 299
300 callback.Run(std::move(suggestions)); 300 callback.Run(std::move(suggestions));
301 } 301 }
302 302
303 void DownloadSuggestionsProvider::OfflinePageModelLoaded( 303 void DownloadSuggestionsProvider::OfflinePageModelLoaded(
304 offline_pages::OfflinePageModel* model) { 304 offline_pages::OfflinePageModel* model) {
305 DCHECK_EQ(offline_page_model_, model); 305 DCHECK_EQ(offline_page_model_, model);
306 AsynchronouslyFetchOfflinePagesDownloads(/*notify=*/true); 306 AsynchronouslyFetchOfflinePagesDownloads(/*notify=*/true);
307 } 307 }
308 308
309 void DownloadSuggestionsProvider::OfflinePageModelChanged( 309 void DownloadSuggestionsProvider::OfflinePageAdded(
310 offline_pages::OfflinePageModel* model) { 310 offline_pages::OfflinePageModel* model,
311 const offline_pages::OfflinePageItem& added_page) {
312 // TODO(dewittj, vitaliii): Don't refetch everything when this is called.
311 DCHECK_EQ(offline_page_model_, model); 313 DCHECK_EQ(offline_page_model_, model);
312 AsynchronouslyFetchOfflinePagesDownloads(/*notify=*/true); 314 AsynchronouslyFetchOfflinePagesDownloads(/*notify=*/true);
313 } 315 }
314 316
315 void DownloadSuggestionsProvider::OfflinePageDeleted( 317 void DownloadSuggestionsProvider::OfflinePageDeleted(
316 int64_t offline_id, 318 int64_t offline_id,
317 const offline_pages::ClientId& client_id) { 319 const offline_pages::ClientId& client_id) {
318 DCHECK(offline_page_model_); 320 DCHECK(offline_page_model_);
319 if (IsClientIdForOfflinePageDownload( 321 if (IsClientIdForOfflinePageDownload(
320 offline_page_model_->GetPolicyController(), client_id)) { 322 offline_page_model_->GetPolicyController(), client_id)) {
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 void DownloadSuggestionsProvider::UnregisterDownloadItemObservers() { 747 void DownloadSuggestionsProvider::UnregisterDownloadItemObservers() {
746 DCHECK_NE(download_manager_, nullptr); 748 DCHECK_NE(download_manager_, nullptr);
747 749
748 std::vector<DownloadItem*> all_downloads; 750 std::vector<DownloadItem*> all_downloads;
749 download_manager_->GetAllDownloads(&all_downloads); 751 download_manager_->GetAllDownloads(&all_downloads);
750 752
751 for (DownloadItem* item : all_downloads) { 753 for (DownloadItem* item : all_downloads) {
752 item->RemoveObserver(this); 754 item->RemoveObserver(this);
753 } 755 }
754 } 756 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698