// Copyright 2016 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_SAFE_BROWSING_CORE_BROWSER_DB_V4_DATABASE_H_ #define COMPONENTS_SAFE_BROWSING_CORE_BROWSER_DB_V4_DATABASE_H_ #include <memory> #include <string> #include <unordered_map> #include <vector> #include "base/files/file_path.h" #include "base/functional/callback.h" #include "base/gtest_prod_util.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/sequence_checker.h" #include "base/task/sequenced_task_runner.h" #include "base/time/time.h" #include "components/safe_browsing/core/browser/db/v4_protocol_manager_util.h" #include "components/safe_browsing/core/browser/db/v4_store.h" #include "components/safe_browsing/core/common/proto/webui.pb.h" class SafeBrowsingServiceTest; class TestSafeBrowsingDatabaseHelper; namespace safe_browsing { class V4Database; // Scheduled when the database has been read from disk and is ready to process // resource reputation requests. NewDatabaseReadyCallback; // Scheduled when the checksum for all the stores in the database has been // verified to match the expected value. Stores for which the checksum did not // match are passed as the argument and need to be reset. DatabaseReadyForUpdatesCallback; // This callback is scheduled once the database has finished processing the // update requests for all stores and is ready to process the next set of update // requests. DatabaseUpdatedCallback; // Maps the ListIdentifiers to their corresponding in-memory stores, which // contain the hash prefixes for that ListIdentifier as well as manage their // storage on disk. StoreMap; // Associates metadata for a list with its ListIdentifier. class ListInfo { … }; ListInfos; // Factory for creating V4Database. Tests implement this factory to create fake // databases for testing. class V4DatabaseFactory { … }; // The on-disk databases are shared among all profiles, as it doesn't contain // 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. // The hash-prefixes of each type are managed by a V4Store (including saving to // and reading from disk). // The V4Database serves as a single place to manage all the V4Stores. class V4Database { … }; } // namespace safe_browsing #endif // COMPONENTS_SAFE_BROWSING_CORE_BROWSER_DB_V4_DATABASE_H_