Chromium Code Reviews| Index: components/safe_browsing_db/v4_database_impl.h |
| diff --git a/components/safe_browsing_db/v4_database_impl.h b/components/safe_browsing_db/v4_database_impl.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..150a05cd61d8c7ee9ba299d1333c70df1c911365 |
| --- /dev/null |
| +++ b/components/safe_browsing_db/v4_database_impl.h |
| @@ -0,0 +1,49 @@ |
| +// Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| +// 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_IMPL_H_ |
| +#define COMPONENTS_SAFE_BROWSING_DB_V4_DATABASE_IMPL_H_ |
| + |
| +#include "components/safe_browsing_db/v4_database.h" |
| + |
| +namespace safe_browsing { |
| + |
| +struct UpdateListIdentifier; |
| +class V4Store; |
| + |
| +typedef std::unique_ptr< |
| + base::hash_map<UpdateListIdentifier, std::unique_ptr<V4Store>>> |
| + StoreMap; |
| + |
| +// The on-disk databases are shared among all profiles, as it doesn't contain |
|
Nathan Parker
2016/05/05 18:26:44
nit: No need to duplicate the comment from the int
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 V4DatabaseImpl : public V4Database { |
| + public: |
| + // Stores a map of the stores it manages. Takes ownership of the map. |
| + V4DatabaseImpl( |
| + const scoped_refptr<base::SequencedTaskRunner>& db_task_runner, |
| + StoreMap store_map); |
| + |
| + ~V4DatabaseImpl() override; |
| + |
| + // Initializes the database with the given filename. |
| + void Init(const base::FilePath& filename) override; |
| + |
| + // Deletes the current database and creates a new one. |
| + bool ResetDatabase() override; |
| + |
| + private: |
| + // The factory used to instantiate a V4Database object. |
| + // Useful for tests, so they can provide their own implementation of |
| + // V4Database. |
| + static V4DatabaseFactory* factory_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(V4DatabaseImpl); |
| +}; |
| + |
| +} // namespace safe_browsing |
| + |
| +#endif // COMPONENTS_SAFE_BROWSING_DB_V4_DATABASE_IMPL_H_ |