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

Unified Diff: components/safe_browsing_db/v4_database.h

Issue 2353413002: Store list information in ListInfo (was: StoreIdAndFIleName) (Closed)
Patch Set: s/StoreIdAndFileName/ListInfo. Move SBThreatType into ListInfo. Created 4 years, 3 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/safe_browsing_db/v4_database.h
diff --git a/components/safe_browsing_db/v4_database.h b/components/safe_browsing_db/v4_database.h
index 26d60915a3d1469ad8c6eba38cdaec73c17f74b8..e4ac3390e6c33110470370bedaf022fbaeaa35cc 100644
--- a/components/safe_browsing_db/v4_database.h
+++ b/components/safe_browsing_db/v4_database.h
@@ -30,27 +30,38 @@ typedef base::Callback<void()> DatabaseUpdatedCallback;
// storage on disk.
typedef base::hash_map<ListIdentifier, std::unique_ptr<V4Store>> StoreMap;
-// TODO(vakh): Find the canonical place where these are defined and update the
-// comment to point to that place.
-struct StoreIdAndFileName {
+struct ListInfo {
Nathan Parker 2016/09/22 18:35:13 Add a comment for this struct (associates various
vakh (use Gerrit instead) 2016/09/22 20:33:41 Added a single line that explains the purpose of t
+ ListInfo(const ListIdentifier& list_id,
+ const std::string& filename,
+ const SBThreatType sb_threat_type,
+ const bool fetch_updates);
+ ~ListInfo();
+
+ ListIdentifier list_id() const { return list_id_; }
+ std::string filename() const { return filename_; }
+ SBThreatType sb_threat_type() const { return sb_threat_type_; }
+ bool fetch_updates() const { return fetch_updates_; }
Nathan Parker 2016/09/22 18:35:13 (At first I read this wrong and I started to write
vakh (use Gerrit instead) 2016/09/22 20:33:41 Acknowledged.
+
+ private:
// The list being read from/written to the disk.
- ListIdentifier list_id;
+ ListIdentifier list_id_;
// The ASCII name of the file on disk. This file is created inside the
// user-data directory. For instance, the ListIdentifier could be for URL
// expressions for UwS on Windows platform, and the corresponding file on disk
// could be named: "UrlUws.store"
- std::string filename;
+ std::string filename_;
- StoreIdAndFileName(const ListIdentifier& list_id,
- const std::string& filename);
- ~StoreIdAndFileName();
+ // The threat type enum value for this store.
+ SBThreatType sb_threat_type_;
- private:
- StoreIdAndFileName();
+ // Whether to fetch and store updates for this list.
+ bool fetch_updates_;
+
+ ListInfo();
};
-using StoreIdAndFileNames = std::vector<StoreIdAndFileName>;
+typedef std::vector<ListInfo> ListInfos;
// Factory for creating V4Database. Tests implement this factory to create fake
// databases for testing.
@@ -60,7 +71,7 @@ class V4DatabaseFactory {
virtual V4Database* CreateV4Database(
const scoped_refptr<base::SequencedTaskRunner>& db_task_runner,
const base::FilePath& base_dir_path,
- const StoreIdAndFileNames& store_id_file_names) = 0;
+ const ListInfos& list_infos) = 0;
};
// The on-disk databases are shared among all profiles, as it doesn't contain
@@ -79,7 +90,7 @@ class V4Database {
static void Create(
const scoped_refptr<base::SequencedTaskRunner>& db_task_runner,
const base::FilePath& base_path,
- const StoreIdAndFileNames& store_id_file_names,
+ const ListInfos& list_infos,
NewDatabaseReadyCallback callback);
// Destroys the provided v4_database on its task_runner since this may be a
@@ -133,7 +144,7 @@ class V4Database {
static void CreateOnTaskRunner(
const scoped_refptr<base::SequencedTaskRunner>& db_task_runner,
const base::FilePath& base_path,
- const StoreIdAndFileNames& store_id_file_names,
+ const ListInfos& list_infos,
const scoped_refptr<base::SingleThreadTaskRunner>& callback_task_runner,
NewDatabaseReadyCallback callback);

Powered by Google App Engine
This is Rietveld 408576698