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

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

Issue 2507793002: [NTP] Propagate OfflineId from C++ for Downloads. (Closed)
Patch Set: rebase. 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/content_suggestion.cc ('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/offline_pages/recent_tab_suggestions_provider. h" 5 #include "components/ntp_snippets/offline_pages/recent_tab_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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 // TODO(vitaliii): Remove this fallback once the OfflinePageModel provides 250 // TODO(vitaliii): Remove this fallback once the OfflinePageModel provides
251 // titles for all (relevant) OfflinePageItems. 251 // titles for all (relevant) OfflinePageItems.
252 suggestion.set_title(base::UTF8ToUTF16(offline_page.url.spec())); 252 suggestion.set_title(base::UTF8ToUTF16(offline_page.url.spec()));
253 } else { 253 } else {
254 suggestion.set_title(offline_page.title); 254 suggestion.set_title(offline_page.title);
255 } 255 }
256 suggestion.set_publish_date(offline_page.creation_time); 256 suggestion.set_publish_date(offline_page.creation_time);
257 suggestion.set_publisher_name(base::UTF8ToUTF16(offline_page.url.host())); 257 suggestion.set_publisher_name(base::UTF8ToUTF16(offline_page.url.host()));
258 auto extra = base::MakeUnique<RecentTabSuggestionExtra>(); 258 auto extra = base::MakeUnique<RecentTabSuggestionExtra>();
259 extra->tab_id = offline_page.client_id.id; 259 extra->tab_id = offline_page.client_id.id;
260 extra->offline_page_id = base::Int64ToString(offline_page.offline_id); 260 extra->offline_page_id = offline_page.offline_id;
261 suggestion.set_recent_tab_suggestion_extra(std::move(extra)); 261 suggestion.set_recent_tab_suggestion_extra(std::move(extra));
262 return suggestion; 262 return suggestion;
263 } 263 }
264 264
265 std::vector<ContentSuggestion> 265 std::vector<ContentSuggestion>
266 RecentTabSuggestionsProvider::GetMostRecentlyVisited( 266 RecentTabSuggestionsProvider::GetMostRecentlyVisited(
267 std::vector<const OfflinePageItem*> offline_page_items) const { 267 std::vector<const OfflinePageItem*> offline_page_items) const {
268 std::sort(offline_page_items.begin(), offline_page_items.end(), 268 std::sort(offline_page_items.begin(), offline_page_items.end(),
269 OrderOfflinePagesByMostRecentlyVisitedFirst()); 269 OrderOfflinePagesByMostRecentlyVisitedFirst());
270 std::vector<ContentSuggestion> suggestions; 270 std::vector<ContentSuggestion> suggestions;
(...skipping 25 matching lines...) Expand all
296 } 296 }
297 297
298 void RecentTabSuggestionsProvider::StoreDismissedIDsToPrefs( 298 void RecentTabSuggestionsProvider::StoreDismissedIDsToPrefs(
299 const std::set<std::string>& dismissed_ids) { 299 const std::set<std::string>& dismissed_ids) {
300 prefs::StoreDismissedIDsToPrefs(pref_service_, 300 prefs::StoreDismissedIDsToPrefs(pref_service_,
301 prefs::kDismissedRecentOfflineTabSuggestions, 301 prefs::kDismissedRecentOfflineTabSuggestions,
302 dismissed_ids); 302 dismissed_ids);
303 } 303 }
304 304
305 } // namespace ntp_snippets 305 } // namespace ntp_snippets
OLDNEW
« no previous file with comments | « components/ntp_snippets/content_suggestion.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698