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

Side by Side Diff: components/ntp_snippets/sessions/foreign_sessions_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
« no previous file with comments | « components/ntp_snippets/sessions/foreign_sessions_suggestions_provider.h ('k') | no next file » | 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 "components/ntp_snippets/sessions/foreign_sessions_suggestions_provider .h" 5 #include "components/ntp_snippets/sessions/foreign_sessions_suggestions_provider .h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <tuple> 9 #include <tuple>
10 #include <utility> 10 #include <utility>
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 void ForeignSessionsSuggestionsProvider::FetchSuggestionImage( 147 void ForeignSessionsSuggestionsProvider::FetchSuggestionImage(
148 const ContentSuggestion::ID& suggestion_id, 148 const ContentSuggestion::ID& suggestion_id,
149 const ImageFetchedCallback& callback) { 149 const ImageFetchedCallback& callback) {
150 base::ThreadTaskRunnerHandle::Get()->PostTask( 150 base::ThreadTaskRunnerHandle::Get()->PostTask(
151 FROM_HERE, base::Bind(callback, gfx::Image())); 151 FROM_HERE, base::Bind(callback, gfx::Image()));
152 } 152 }
153 153
154 void ForeignSessionsSuggestionsProvider::Fetch( 154 void ForeignSessionsSuggestionsProvider::Fetch(
155 const Category& category, 155 const Category& category,
156 const std::set<std::string>& known_suggestion_ids, 156 const std::set<std::string>& known_suggestion_ids,
157 FetchingCallback callback) { 157 const FetchingCallback& callback) {
158 NOTREACHED(); 158 NOTREACHED();
159 } 159 }
160 160
161 void ForeignSessionsSuggestionsProvider::ClearHistory( 161 void ForeignSessionsSuggestionsProvider::ClearHistory(
162 base::Time begin, 162 base::Time begin,
163 base::Time end, 163 base::Time end,
164 const base::Callback<bool(const GURL& url)>& filter) { 164 const base::Callback<bool(const GURL& url)>& filter) {
165 std::set<std::string> dismissed_ids = prefs::ReadDismissedIDsFromPrefs( 165 std::set<std::string> dismissed_ids = prefs::ReadDismissedIDsFromPrefs(
166 *pref_service_, prefs::kDismissedForeignSessionsSuggestions); 166 *pref_service_, prefs::kDismissedForeignSessionsSuggestions);
167 for (auto iter = dismissed_ids.begin(); iter != dismissed_ids.end();) { 167 for (auto iter = dismissed_ids.begin(); iter != dismissed_ids.end();) {
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 // This field is sandwiched between the url's favicon, which is on the left, 318 // This field is sandwiched between the url's favicon, which is on the left,
319 // and the |publish_date|, which is to the right. The domain should always 319 // and the |publish_date|, which is to the right. The domain should always
320 // appear next to the favicon. 320 // appear next to the favicon.
321 suggestion.set_publisher_name( 321 suggestion.set_publisher_name(
322 base::UTF8ToUTF16(data.navigation->virtual_url().host() + " - " + 322 base::UTF8ToUTF16(data.navigation->virtual_url().host() + " - " +
323 data.session->session_name)); 323 data.session->session_name));
324 return suggestion; 324 return suggestion;
325 } 325 }
326 326
327 } // namespace ntp_snippets 327 } // namespace ntp_snippets
OLDNEW
« no previous file with comments | « components/ntp_snippets/sessions/foreign_sessions_suggestions_provider.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698