#include "chrome/browser/extensions/blocklist.h"
#include <algorithm>
#include <iterator>
#include <memory>
#include "base/callback_list.h"
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/lazy_instance.h"
#include "base/memory/ref_counted.h"
#include "base/observer_list.h"
#include "base/task/single_thread_task_runner.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/blocklist_factory.h"
#include "chrome/browser/extensions/blocklist_state_fetcher.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include "components/prefs/pref_service.h"
#include "components/safe_browsing/buildflags.h"
#include "components/safe_browsing/core/browser/db/database_manager.h"
#include "components/safe_browsing/core/browser/db/util.h"
#include "components/safe_browsing/core/common/features.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/common/extension_id.h"
BrowserThread;
SafeBrowsingDatabaseManager;
namespace extensions {
namespace {
class LazySafeBrowsingDatabaseManager { … };
static base::LazyInstance<LazySafeBrowsingDatabaseManager>::DestructorAtExit
g_database_manager = …;
class SafeBrowsingClientImpl
: public SafeBrowsingDatabaseManager::Client,
public base::RefCountedThreadSafe<SafeBrowsingClientImpl> { … };
void CheckOneExtensionState(Blocklist::IsBlocklistedCallback callback,
const Blocklist::BlocklistStateMap& state_map) { … }
void GetMalwareFromBlocklistStateMap(
Blocklist::GetMalwareIDsCallback callback,
const Blocklist::BlocklistStateMap& state_map) { … }
}
Blocklist::Observer::Observer(Blocklist* blocklist) : … { … }
Blocklist::Observer::~Observer() { … }
Blocklist::Blocklist() { … }
Blocklist::~Blocklist() { … }
Blocklist* Blocklist::Get(content::BrowserContext* context) { … }
void Blocklist::GetBlocklistedIDs(const std::set<ExtensionId>& ids,
GetBlocklistedIDsCallback callback) { … }
void Blocklist::GetMalwareIDs(const std::set<ExtensionId>& ids,
GetMalwareIDsCallback callback) { … }
void Blocklist::IsBlocklisted(const ExtensionId& extension_id,
IsBlocklistedCallback callback) { … }
void Blocklist::GetBlocklistStateForIDs(
GetBlocklistedIDsCallback callback,
const std::set<ExtensionId>& blocklisted_ids) { … }
void Blocklist::ReturnBlocklistStateMap(
GetBlocklistedIDsCallback callback,
const std::set<ExtensionId>& blocklisted_ids) { … }
void Blocklist::RequestExtensionsBlocklistState(
const std::set<ExtensionId>& ids,
base::OnceClosure callback) { … }
void Blocklist::OnBlocklistStateReceived(const ExtensionId& id,
BlocklistState state) { … }
void Blocklist::SetBlocklistStateFetcherForTest(
BlocklistStateFetcher* fetcher) { … }
BlocklistStateFetcher* Blocklist::ResetBlocklistStateFetcherForTest() { … }
void Blocklist::ResetDatabaseUpdatedListenerForTest() { … }
void Blocklist::ResetBlocklistStateCacheForTest() { … }
void Blocklist::AddObserver(Observer* observer) { … }
void Blocklist::RemoveObserver(Observer* observer) { … }
void Blocklist::IsDatabaseReady(DatabaseReadyCallback callback) { … }
void Blocklist::SetDatabaseManager(
scoped_refptr<SafeBrowsingDatabaseManager> database_manager) { … }
scoped_refptr<SafeBrowsingDatabaseManager> Blocklist::GetDatabaseManager() { … }
void Blocklist::ObserveNewDatabase() { … }
void Blocklist::NotifyObservers() { … }
}