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

Unified Diff: components/ntp_snippets/bookmarks/bookmark_suggestions_provider.cc

Issue 2256183004: Use bookmark creation date fallback for 6 weeks after installing M54 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits from Jan's previous CL 2256643002/#ps20001 Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/ntp_snippets/bookmarks/bookmark_last_visit_utils.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/ntp_snippets/bookmarks/bookmark_suggestions_provider.cc
diff --git a/components/ntp_snippets/bookmarks/bookmark_suggestions_provider.cc b/components/ntp_snippets/bookmarks/bookmark_suggestions_provider.cc
index 04395e5c570d511e5f7abd467f852a0437dedffc..2167dbc0fef4b756021caf5466fe9a37732bc6ba 100644
--- a/components/ntp_snippets/bookmarks/bookmark_suggestions_provider.cc
+++ b/components/ntp_snippets/bookmarks/bookmark_suggestions_provider.cc
@@ -31,9 +31,9 @@ const int kMaxBookmarks = 10;
const int kMinBookmarks = 3;
const int kMaxBookmarkAgeInDays = 42;
-const char* kMaxBookmarksParamName = "max_count";
-const char* kMinBookmarksParamName = "min_count";
-const char* kMaxBookmarkAgeInDaysParamName = "max_age_in_days";
+const char* kMaxBookmarksParamName = "ntp_bookmarks_max_count";
+const char* kMinBookmarksParamName = "ntp_bookmarks_min_count";
+const char* kMaxBookmarkAgeInDaysParamName = "ntp_bookmarks_max_age_in_days";
Marc Treib 2016/08/19 11:41:11 nit: I'd remove the "ntp_", that much is clear fro
Philipp Keck 2016/08/19 12:49:52 Done.
base::Time GetThresholdTime() {
std::string age_in_days_string = variations::GetVariationParamValueByFeature(
@@ -61,6 +61,8 @@ int GetMinCount() {
int min_count = 0;
if (base::StringToInt(min_count_string, &min_count))
return min_count;
+ if (!min_count_string.empty())
+ LOG(WARNING) << "Failed to parse min bookmarks count" << min_count_string;
Marc Treib 2016/08/19 11:41:11 Add the same above for max_count please
Philipp Keck 2016/08/19 12:49:52 Done. Also for age_in_days_string (GetThresholdTim
return kMinBookmarks;
}
@@ -162,14 +164,15 @@ void BookmarkSuggestionsProvider::OnWillChangeBookmarkMetaInfo(
BookmarkModel* model,
const BookmarkNode* node) {
// Store the last visit date of the node that is about to change.
- node_to_change_last_visit_date_ =
- GetLastVisitDateForBookmarkIfNotDismissed(node);
+ node_to_change_last_visit_date_ = GetLastVisitDateForBookmarkIfNotDismissed(
+ node, /*creation_date_fallback=*/true);
}
void BookmarkSuggestionsProvider::BookmarkMetaInfoChanged(
BookmarkModel* model,
const BookmarkNode* node) {
- base::Time time = GetLastVisitDateForBookmarkIfNotDismissed(node);
+ base::Time time = GetLastVisitDateForBookmarkIfNotDismissed(
+ node, /*creation_date_fallback=*/true);
if (time == node_to_change_last_visit_date_ ||
time < end_of_list_last_visit_date_)
return;
@@ -185,9 +188,11 @@ void BookmarkSuggestionsProvider::BookmarkNodeRemoved(
int old_index,
const bookmarks::BookmarkNode* node,
const std::set<GURL>& no_longer_bookmarked) {
- if (GetLastVisitDateForBookmarkIfNotDismissed(node) <
- end_of_list_last_visit_date_)
+ if (GetLastVisitDateForBookmarkIfNotDismissed(
+ node, /*creation_date_fallback=*/true) <
+ end_of_list_last_visit_date_) {
return;
+ }
// Some node from our list got deleted, we should update the suggestions.
FetchBookmarks();
@@ -201,7 +206,8 @@ ContentSuggestion BookmarkSuggestionsProvider::ConvertBookmark(
suggestion.set_title(bookmark->GetTitle());
suggestion.set_snippet_text(base::string16());
- suggestion.set_publish_date(GetLastVisitDateForBookmark(bookmark));
+ suggestion.set_publish_date(
+ GetLastVisitDateForBookmark(bookmark, /*creation_date_fallback=*/true));
suggestion.set_publisher_name(base::UTF8ToUTF16(bookmark->url().host()));
return suggestion;
}
« no previous file with comments | « components/ntp_snippets/bookmarks/bookmark_last_visit_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698