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

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

Issue 2683553003: [NTP::Downloads] Consider recently visited offline pages not outdated. (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.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 #ifndef CHROME_BROWSER_NTP_SNIPPETS_DOWNLOAD_SUGGESTIONS_PROVIDER_H_ 5 #ifndef CHROME_BROWSER_NTP_SNIPPETS_DOWNLOAD_SUGGESTIONS_PROVIDER_H_
6 #define CHROME_BROWSER_NTP_SNIPPETS_DOWNLOAD_SUGGESTIONS_PROVIDER_H_ 6 #define CHROME_BROWSER_NTP_SNIPPETS_DOWNLOAD_SUGGESTIONS_PROVIDER_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 134
135 // Converts an OfflinePageItem to a ContentSuggestion for the 135 // Converts an OfflinePageItem to a ContentSuggestion for the
136 // |provided_category_|. 136 // |provided_category_|.
137 ntp_snippets::ContentSuggestion ConvertOfflinePage( 137 ntp_snippets::ContentSuggestion ConvertOfflinePage(
138 const offline_pages::OfflinePageItem& offline_page) const; 138 const offline_pages::OfflinePageItem& offline_page) const;
139 139
140 // Converts DownloadItem to a ContentSuggestion for the |provided_category_|. 140 // Converts DownloadItem to a ContentSuggestion for the |provided_category_|.
141 ntp_snippets::ContentSuggestion ConvertDownloadItem( 141 ntp_snippets::ContentSuggestion ConvertDownloadItem(
142 const content::DownloadItem& download_item) const; 142 const content::DownloadItem& download_item) const;
143 143
144 // Returns true if a download published time is considered too old for the 144 // Returns true if a download published and last visited times are considered
145 // download to be shown. 145 // too old for the download to be shown.
146 bool IsDownloadOutdated(const base::Time& published_time); 146 bool IsDownloadOutdated(const base::Time& published_time,
147 const base::Time& last_visited_time);
147 148
148 // Adds |item| to the internal asset download cache if all of the following 149 // Adds |item| to the internal asset download cache if all of the following
149 // holds: 150 // holds:
150 // - the download is completed; 151 // - the download is completed;
151 // - its suggestion has not been dismissed; 152 // - its suggestion has not been dismissed;
152 // - there are less than |kMaxSuggestionsCount| items cached or the oldest 153 // - there are less than |kMaxSuggestionsCount| items cached or the oldest
153 // cached item is older than the current item (the oldest item is removed 154 // cached item is older than the current item (the oldest item is removed
154 // then); 155 // then);
155 // - the item is not present in the cache yet. 156 // - the item is not present in the cache yet.
156 // Returns |true| if the item has been added. 157 // Returns |true| if the item has been added.
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 std::vector<const content::DownloadItem*> cached_asset_downloads_; 232 std::vector<const content::DownloadItem*> cached_asset_downloads_;
232 233
233 bool is_asset_downloads_initialization_complete_; 234 bool is_asset_downloads_initialization_complete_;
234 235
235 base::WeakPtrFactory<DownloadSuggestionsProvider> weak_ptr_factory_; 236 base::WeakPtrFactory<DownloadSuggestionsProvider> weak_ptr_factory_;
236 237
237 DISALLOW_COPY_AND_ASSIGN(DownloadSuggestionsProvider); 238 DISALLOW_COPY_AND_ASSIGN(DownloadSuggestionsProvider);
238 }; 239 };
239 240
240 #endif // CHROME_BROWSER_NTP_SNIPPETS_DOWNLOAD_SUGGESTIONS_PROVIDER_H_ 241 #endif // CHROME_BROWSER_NTP_SNIPPETS_DOWNLOAD_SUGGESTIONS_PROVIDER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ntp_snippets/download_suggestions_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698