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

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

Issue 2706863002: Merge "[NTP::Downloads] Do not fetch Offline Pages when their model ..." (Closed)
Patch Set: Created 3 years, 10 months 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
« no previous file with comments | « no previous file | chrome/browser/ntp_snippets/download_suggestions_provider_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 } 313 }
314 } 314 }
315 } 315 }
316 316
317 callback.Run(std::move(suggestions)); 317 callback.Run(std::move(suggestions));
318 } 318 }
319 319
320 void DownloadSuggestionsProvider::OfflinePageModelLoaded( 320 void DownloadSuggestionsProvider::OfflinePageModelLoaded(
321 offline_pages::OfflinePageModel* model) { 321 offline_pages::OfflinePageModel* model) {
322 DCHECK_EQ(offline_page_model_, model); 322 DCHECK_EQ(offline_page_model_, model);
323 AsynchronouslyFetchOfflinePagesDownloads(/*notify=*/true); 323 // Ignored. We issue a fetch in the constructor (or when Downloads Manager is
324 // loaded) and Offline Page model answers asynchronously once it has been
325 // loaded.
324 } 326 }
325 327
326 void DownloadSuggestionsProvider::OfflinePageAdded( 328 void DownloadSuggestionsProvider::OfflinePageAdded(
327 offline_pages::OfflinePageModel* model, 329 offline_pages::OfflinePageModel* model,
328 const offline_pages::OfflinePageItem& added_page) { 330 const offline_pages::OfflinePageItem& added_page) {
329 DCHECK_EQ(offline_page_model_, model); 331 DCHECK_EQ(offline_page_model_, model);
330 if (!IsClientIdForOfflinePageDownload(model->GetPolicyController(), 332 if (!IsClientIdForOfflinePageDownload(model->GetPolicyController(),
331 added_page.client_id)) { 333 added_page.client_id)) {
332 return; 334 return;
333 } 335 }
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 void DownloadSuggestionsProvider::UnregisterDownloadItemObservers() { 812 void DownloadSuggestionsProvider::UnregisterDownloadItemObservers() {
811 DCHECK_NE(download_manager_, nullptr); 813 DCHECK_NE(download_manager_, nullptr);
812 814
813 std::vector<DownloadItem*> all_downloads; 815 std::vector<DownloadItem*> all_downloads;
814 download_manager_->GetAllDownloads(&all_downloads); 816 download_manager_->GetAllDownloads(&all_downloads);
815 817
816 for (DownloadItem* item : all_downloads) { 818 for (DownloadItem* item : all_downloads) {
817 item->RemoveObserver(this); 819 item->RemoveObserver(this);
818 } 820 }
819 } 821 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ntp_snippets/download_suggestions_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698