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

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

Issue 2485933003: Fixes an invalidated pointer access in NTPSnipppetsFetcher. (Closed)
Patch Set: adressed other comments from https://codereview.chromium.org/2473483006/ 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 "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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 // available there. 160 // available there.
161 // TODO(vitaliii): Provide site's favicon for assets downloads. See 161 // TODO(vitaliii): Provide site's favicon for assets downloads. See
162 // crbug.com/631447. 162 // crbug.com/631447.
163 base::ThreadTaskRunnerHandle::Get()->PostTask( 163 base::ThreadTaskRunnerHandle::Get()->PostTask(
164 FROM_HERE, base::Bind(callback, gfx::Image())); 164 FROM_HERE, base::Bind(callback, gfx::Image()));
165 } 165 }
166 166
167 void DownloadSuggestionsProvider::Fetch( 167 void DownloadSuggestionsProvider::Fetch(
168 const ntp_snippets::Category& category, 168 const ntp_snippets::Category& category,
169 const std::set<std::string>& known_suggestion_ids, 169 const std::set<std::string>& known_suggestion_ids,
170 FetchingCallback callback) { 170 const FetchingCallback& callback) {
171 NOTREACHED(); 171 NOTREACHED();
172 base::ThreadTaskRunnerHandle::Get()->PostTask( 172 base::ThreadTaskRunnerHandle::Get()->PostTask(
173 FROM_HERE, 173 FROM_HERE,
174 base::Bind(callback, base::Passed(std::vector<ContentSuggestion>()))); 174 base::Bind(callback, base::Passed(std::vector<ContentSuggestion>())));
175 } 175 }
176 176
177 void DownloadSuggestionsProvider::ClearHistory( 177 void DownloadSuggestionsProvider::ClearHistory(
178 base::Time begin, 178 base::Time begin,
179 base::Time end, 179 base::Time end,
180 const base::Callback<bool(const GURL& url)>& filter) { 180 const base::Callback<bool(const GURL& url)>& filter) {
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 638
639 void DownloadSuggestionsProvider::UnregisterDownloadItemObservers() { 639 void DownloadSuggestionsProvider::UnregisterDownloadItemObservers() {
640 DCHECK_NE(download_manager_, nullptr); 640 DCHECK_NE(download_manager_, nullptr);
641 641
642 std::vector<DownloadItem*> all_downloads; 642 std::vector<DownloadItem*> all_downloads;
643 download_manager_->GetAllDownloads(&all_downloads); 643 download_manager_->GetAllDownloads(&all_downloads);
644 644
645 for (DownloadItem* item : all_downloads) 645 for (DownloadItem* item : all_downloads)
646 item->RemoveObserver(this); 646 item->RemoveObserver(this);
647 } 647 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698