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

Unified Diff: components/previews/core/previews_black_list.h

Issue 2442013003: Add non-host functionality to the previews blacklist (Closed)
Patch Set: rebase and test 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/previews/core/previews_black_list.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/previews/core/previews_black_list.h
diff --git a/components/previews/core/previews_black_list.h b/components/previews/core/previews_black_list.h
index a1e36cc9033a2eb1b403f9cc71dee1e72a1e3508..ad192463f17372ea9b166b89fa643976b99d4584 100644
--- a/components/previews/core/previews_black_list.h
+++ b/components/previews/core/previews_black_list.h
@@ -63,53 +63,57 @@ class PreviewsBlackList {
bool IsLoadedAndAllowed(const GURL& url, PreviewsType type) const;
// Asynchronously deletes all entries in the in-memory black list. Informs
// the backing store to delete entries between |begin_time| and |end_time|,
// and reloads entries into memory from the backing store. If the embedder
// passed in a null store, resets all history in the in-memory black list.
void ClearBlackList(base::Time begin_time, base::Time end_time);
// Returns a new PreviewsBlackListItem representing |host_name|. Adds the new
// item to |black_list_item_map|.
- static PreviewsBlackListItem* GetOrCreateBlackListItem(
+ static PreviewsBlackListItem* GetOrCreateBlackListItemForMap(
BlackListItemMap* black_list_item_map,
const std::string& host_name);
- // Returns the PreviewsBlackListItem representing |host_name| in
- // |black_list_item_map|. If there is no item for |host_name|, returns null.
- static PreviewsBlackListItem* GetBlackListItem(
- const BlackListItemMap& black_list_item_map,
- const std::string& host_name);
+ // Returns a new PreviewsBlackListItem for the host indifferent black list
+ // that does not consider host name when determining eligibility.
+ static std::unique_ptr<PreviewsBlackListItem>
+ CreateHostIndifferentBlackListItem();
private:
// Synchronous version of AddPreviewNavigation method.
void AddPreviewNavigationSync(const GURL& host_name,
bool opt_out,
PreviewsType type);
// Synchronous version of ClearBlackList method.
void ClearBlackListSync(base::Time begin_time, base::Time end_time);
// Callback passed to the backing store when loading black list information.
- // Moves the returned map into the in-memory black list and runs any
- // outstanding tasks.
- void LoadBlackListDone(std::unique_ptr<BlackListItemMap> black_list_item_map);
+ // Moves the |black_list_item_map| and |host_indifferent_black_list_item| into
+ // the in-memory black list and runs any outstanding tasks.
+ void LoadBlackListDone(
+ std::unique_ptr<BlackListItemMap> black_list_item_map,
+ std::unique_ptr<PreviewsBlackListItem> host_indifferent_black_list_item);
// Called while waiting for the black list to be loaded from the backing
// store.
// Enqueues a task to run when when loading black list information has
// completed. Maintains the order that tasks were called in.
void QueuePendingTask(base::Closure callback);
// Map maintaining the in-memory black list.
std::unique_ptr<BlackListItemMap> black_list_item_map_;
+ // Host indifferent opt out history.
+ std::unique_ptr<PreviewsBlackListItem> host_indifferent_black_list_item_;
+
// Whether the black list is done being loaded from the backing store.
bool loaded_;
// The time of the last opt out for this session.
base::Optional<base::Time> last_opt_out_time_;
// The backing store of the black list information.
std::unique_ptr<PreviewsOptOutStore> opt_out_store_;
// Callbacks to be run after loading information from the backing store has
« no previous file with comments | « no previous file | components/previews/core/previews_black_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698