Commit 4cd77228 authored by ryansturm's avatar ryansturm Committed by Commit bot

If users clear history, the previews recency rule should be cleared

When a user clears a chunk of history, the recency rule (previews aren't
shown for ~5 minutes after an opt out). Should be reset if the chunk of
history is longer than 5 minutes.

BUG=722436

Review-Url: https://codereview.chromium.org/2878363004
Cr-Commit-Position: refs/heads/master@{#474890}
parent c1604bc8
......@@ -158,6 +158,14 @@ void PreviewsBlackList::ClearBlackListSync(base::Time begin_time,
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(loaded_);
DCHECK_LE(begin_time, end_time);
// Clear last_opt_out_time_ if the period being cleared is larger than the
// short black list timeout and the last time the user opted out was before
// |end_time|.
if (end_time - begin_time > params::SingleOptOutDuration() &&
last_opt_out_time_ && last_opt_out_time_.value() < end_time) {
last_opt_out_time_.reset();
}
black_list_item_map_.reset();
host_indifferent_black_list_item_.reset();
loaded_ = false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment