Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Unified Diff: components/safe_browsing_db/remote_database_manager.cc

Issue 1726403006: Switch Safe Browsing's metadata from string to struct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix ParseJson in test Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/safe_browsing_db/remote_database_manager.cc
diff --git a/components/safe_browsing_db/remote_database_manager.cc b/components/safe_browsing_db/remote_database_manager.cc
index 74c6c0c3a13e1b59122da46dda32fed9a97af38b..47d80627032d99d07ce09c2949da84c324a506fb 100644
--- a/components/safe_browsing_db/remote_database_manager.cc
+++ b/components/safe_browsing_db/remote_database_manager.cc
@@ -42,9 +42,9 @@ class RemoteSafeBrowsingDatabaseManager::ClientRequest {
static void OnRequestDoneWeak(const base::WeakPtr<ClientRequest>& req,
SBThreatType matched_threat_type,
- const std::string& metadata);
+ const ThreatMetadata& metadata);
void OnRequestDone(SBThreatType matched_threat_type,
- const std::string& metadata);
+ const ThreatMetadata& metadata);
// Accessors
Client* client() const { return client_; }
@@ -74,7 +74,7 @@ RemoteSafeBrowsingDatabaseManager::ClientRequest::ClientRequest(
void RemoteSafeBrowsingDatabaseManager::ClientRequest::OnRequestDoneWeak(
const base::WeakPtr<ClientRequest>& req,
SBThreatType matched_threat_type,
- const std::string& metadata) {
+ const ThreatMetadata& metadata) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
if (!req)
return; // Previously canceled
@@ -83,7 +83,7 @@ void RemoteSafeBrowsingDatabaseManager::ClientRequest::OnRequestDoneWeak(
void RemoteSafeBrowsingDatabaseManager::ClientRequest::OnRequestDone(
SBThreatType matched_threat_type,
- const std::string& metadata) {
+ const ThreatMetadata& metadata) {
DVLOG(1) << "OnRequestDone took " << timer_.Elapsed().InMilliseconds()
<< " ms for client " << client_ << " and URL " << url_;
client_->OnCheckBrowseUrlResult(url_, matched_threat_type, metadata);
@@ -251,7 +251,7 @@ bool RemoteSafeBrowsingDatabaseManager::CheckBrowseUrl(const GURL& url,
DVLOG(1) << "Checking for client " << client << " and URL " << url;
SafeBrowsingApiHandler* api_handler = SafeBrowsingApiHandler::GetInstance();
// This shouldn't happen since SafeBrowsingResourceThrottle checks
- // IsSupported() ealier.
+ // IsSupported() earlier.
DCHECK(api_handler) << "SafeBrowsingApiHandler was never constructed";
api_handler->StartURLCheck(
base::Bind(&ClientRequest::OnRequestDoneWeak, req->GetWeakPtr()), url,
@@ -298,7 +298,7 @@ void RemoteSafeBrowsingDatabaseManager::StopOnIOThread(bool shutdown) {
std::vector<ClientRequest*> to_callback(current_requests_);
for (auto req : to_callback) {
DVLOG(1) << "Stopping: Invoking unfinished req for URL " << req->url();
- req->OnRequestDone(SB_THREAT_TYPE_SAFE, std::string());
+ req->OnRequestDone(SB_THREAT_TYPE_SAFE, ThreatMetadata());
}
enabled_ = false;
« no previous file with comments | « components/safe_browsing_db/database_manager.h ('k') | components/safe_browsing_db/safe_browsing_api_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698