Commit 4d109d52 authored by Xinghui Lu's avatar Xinghui Lu Committed by Commit Bot

Construct url_lookup_service on Android

Bug: 1014202
Change-Id: I2c985e1a87e9297c28d6ac10e89ceefeba0e08a1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1860876Reviewed-by: default avatarDaniel Rubery <drubery@chromium.org>
Commit-Queue: Xinghui Lu <xinghuilu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#705739}
parent f9eae99d
......@@ -45,6 +45,7 @@ static_library("remote_database_manager") {
"//components/safe_browsing/db:database_manager",
"//components/safe_browsing/db:v4_get_hash_protocol_manager",
"//components/safe_browsing/db:v4_protocol_manager_util",
"//components/safe_browsing/realtime:url_lookup_service",
"//components/variations",
"//content/public/browser",
"//net",
......
......@@ -90,6 +90,11 @@ void RemoteSafeBrowsingDatabaseManager::ClientRequest::OnRequestDone(
db_manager_->CancelCheck(client_);
}
RealTimeUrlLookupService*
RemoteSafeBrowsingDatabaseManager::GetRealTimeUrlLookupService() {
return rt_url_lookup_service_.get();
}
//
// RemoteSafeBrowsingDatabaseManager methods
//
......@@ -234,7 +239,7 @@ RemoteSafeBrowsingDatabaseManager::CheckUrlForHighConfidenceAllowlist(
const GURL& url,
Client* client) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
NOTREACHED();
// TODO(crbug.com/1014202): Add local high confidence allowlist.
return AsyncMatch::NO_MATCH;
}
......@@ -331,6 +336,10 @@ void RemoteSafeBrowsingDatabaseManager::StartOnIOThread(
const V4ProtocolConfig& config) {
VLOG(1) << "RemoteSafeBrowsingDatabaseManager starting";
SafeBrowsingDatabaseManager::StartOnIOThread(url_loader_factory, config);
rt_url_lookup_service_ =
std::make_unique<RealTimeUrlLookupService>(url_loader_factory);
enabled_ = true;
}
......@@ -348,6 +357,8 @@ void RemoteSafeBrowsingDatabaseManager::StopOnIOThread(bool shutdown) {
}
enabled_ = false;
rt_url_lookup_service_.reset();
SafeBrowsingDatabaseManager::StopOnIOThread(shutdown);
}
......
......@@ -17,6 +17,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "components/safe_browsing/db/database_manager.h"
#include "components/safe_browsing/realtime/url_lookup_service.h"
#include "url/gurl.h"
namespace safe_browsing {
......@@ -62,6 +63,7 @@ class RemoteSafeBrowsingDatabaseManager : public SafeBrowsingDatabaseManager {
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
const V4ProtocolConfig& config) override;
void StopOnIOThread(bool shutdown) override;
RealTimeUrlLookupService* GetRealTimeUrlLookupService() override;
//
// RemoteSafeBrowsingDatabaseManager implementation
......@@ -76,6 +78,8 @@ class RemoteSafeBrowsingDatabaseManager : public SafeBrowsingDatabaseManager {
base::flat_set<content::ResourceType> resource_types_to_check_;
std::unique_ptr<RealTimeUrlLookupService> rt_url_lookup_service_;
friend class base::RefCountedThreadSafe<RemoteSafeBrowsingDatabaseManager>;
DISALLOW_COPY_AND_ASSIGN(RemoteSafeBrowsingDatabaseManager);
}; // class RemoteSafeBrowsingDatabaseManager
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment