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

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

Issue 2390773003: Adding a SQL implementation of the backing store for previews opt outs (Closed)
Patch Set: table change Created 4 years, 2 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
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 e7e9c66a8ba291fb90a271f25522b739add0b5b1..7bd575302df3d7c9531c494e9c5dcd47ddd8cc39 100644
--- a/components/previews/core/previews_black_list.h
+++ b/components/previews/core/previews_black_list.h
@@ -58,52 +58,52 @@ class PreviewsBlackList {
// If the black list has loaded yet, this will always return false. |type| is
// not used to make this decision.
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(
+ 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);
+
private:
// Synchronous version of AddPreviewNavigation method.
void AddPreviewNavigationSync(const GURL& host_name,
bool opt_out,
PreviewsType type);
- // Returns the PreviewsBlackListItem representing |host_name|. If there is no
- // item for |host_name|, returns null.
- PreviewsBlackListItem* GetBlackListItem(const std::string& host_name) const;
-
// Synchronous version of ClearBlackList method.
void ClearBlackListSync(base::Time begin_time, base::Time end_time);
- // Returns a new PreviewsBlackListItem representing |host_name|. Adds the new
- // item to the in-memory map.
- PreviewsBlackListItem* CreateBlackListItem(const std::string& host_name);
-
// 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);
// 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);
- // Evicts one entry from the in-memory black list based on recency of a hosts
- // most recent opt out time.
- void EvictOldestOptOut();
-
// Map maintaining the in-memory black list.
std::unique_ptr<BlackListItemMap> black_list_item_map_;
// Whether the black list is done being loaded from the backing store.
bool loaded_;
// 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

Powered by Google App Engine
This is Rietveld 408576698