Chromium Code Reviews| 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 |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..934d2a6baebd79f7f49fc89311549fc1943d6569 |
| --- /dev/null |
| +++ b/components/safe_browsing_db/v4_database.h |
| @@ -0,0 +1,60 @@ |
| +// Copyright (c) 2016 The Chromium Authors. All rights reserved. |
|
Nathan Parker
2016/05/05 18:26:44
no (c) here anymore
vakh (use Gerrit instead)
2016/05/06 00:23:15
Done.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef COMPONENTS_SAFE_BROWSING_DB_V4_DATABASE_H_ |
| +#define COMPONENTS_SAFE_BROWSING_DB_V4_DATABASE_H_ |
| + |
| +#include "base/files/file_path.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "base/sequenced_task_runner.h" |
| + |
| +namespace safe_browsing { |
| + |
| +class V4Database; |
| + |
| +// Factory for creating V4Database. Tests implement this factory to create fake |
| +// databases for testing. |
| +class V4DatabaseFactory { |
| + public: |
| + V4DatabaseFactory() {} |
| + virtual ~V4DatabaseFactory() {} |
| + virtual V4Database* CreateV4Database( |
| + const scoped_refptr<base::SequencedTaskRunner>& db_task_runner, |
| + bool enable_malware_list, |
|
Nathan Parker
2016/05/05 18:26:44
Do you think we need the enable_* switches? They
vakh (use Gerrit instead)
2016/05/06 00:23:15
Done.
I also realized that this morning. Changing
|
| + bool enable_phishing_list, |
| + bool enable_unwanted_software_list) = 0; |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(V4DatabaseFactory); |
| +}; |
| + |
| +// The on-disk databases are shared among all profiles, as it doesn't contain |
|
Nathan Parker
2016/05/05 18:26:44
Maybe describe the relationship of this to Store's
vakh (use Gerrit instead)
2016/05/06 00:23:15
Done.
|
| +// user-specific data. This object is not thread-safe, i.e. all its methods |
| +// should be used on the same thread that it was created on, unless specified |
| +// otherwise. |
| +class V4Database { |
| + public: |
| + // Factory method for obtaining a V4Database implementation. |
| + // It is not thread safe. |
| + // The availability of each list is controlled by the one flag on this |
| + // method. |
| + static V4Database* Create( |
| + V4DatabaseFactory* factory, |
| + const scoped_refptr<base::SequencedTaskRunner>& db_task_runner, |
| + bool enable_malware_list, |
| + bool enable_phishing_list, |
| + bool enable_unwanted_software_list); |
| + |
| + virtual ~V4Database(); |
| + |
| + // Initializes the database with the given filename. |
| + virtual void Init(const base::FilePath& filename) = 0; |
|
Nathan Parker
2016/05/05 18:26:44
"filename_prefix"?
vakh (use Gerrit instead)
2016/05/06 00:23:15
Done. Removed that part.
The DB maintains the stor
|
| + |
| + // Deletes the current database and creates a new one. |
| + virtual bool ResetDatabase() = 0; |
| +}; |
| + |
| +} // namespace safe_browsing |
| + |
| +#endif // COMPONENTS_SAFE_BROWSING_DB_V4_DATABASE_H_ |