| Index: components/safe_browsing_db/v4_local_database_manager.cc
|
| diff --git a/components/safe_browsing_db/v4_local_database_manager.cc b/components/safe_browsing_db/v4_local_database_manager.cc
|
| index 8b0fd7b706de3696b9de602c3f123b7ff8bd25d3..59c4af93dc6a360feb88e3ce7ebbe7d47fa3bef8 100644
|
| --- a/components/safe_browsing_db/v4_local_database_manager.cc
|
| +++ b/components/safe_browsing_db/v4_local_database_manager.cc
|
| @@ -26,7 +26,7 @@ const ThreatSeverity kLeastSeverity =
|
| // TODO(vakh): Implement this to populate the vector appopriately.
|
| // Filed as http://crbug.com/608075
|
| // Any stores added/removed to/from here likely need an update in
|
| -// GetSBThreatTypeForList and GetThreatSeverity.
|
| +// GetThreatSeverity.
|
| // TODO(vakh): Add a compile-time check or DCHECK to enforce this.
|
| StoreIdAndFileNames GetStoreIdAndFileNames() {
|
| return StoreIdAndFileNames(
|
| @@ -36,22 +36,15 @@ StoreIdAndFileNames GetStoreIdAndFileNames() {
|
|
|
| // Returns the SBThreatType corresponding to a given SafeBrowsing list.
|
| SBThreatType GetSBThreatTypeForList(const ListIdentifier& list_id) {
|
| - if (list_id == GetChromeUrlApiId()) {
|
| - return SB_THREAT_TYPE_API_ABUSE;
|
| - } else if (list_id == GetUrlMalwareId()) {
|
| - return SB_THREAT_TYPE_URL_MALWARE;
|
| - } else if (list_id == GetUrlSocEngId()) {
|
| - return SB_THREAT_TYPE_URL_PHISHING;
|
| - } else {
|
| - NOTREACHED() << "Unknown list encountered in GetSBThreatTypeForList";
|
| - return SB_THREAT_TYPE_SAFE;
|
| - }
|
| + SBThreatType sb_threat_type = list_id.sb_threat_type();
|
| + DCHECK_NE(SB_THREAT_TYPE_SAFE, sb_threat_type);
|
| + return sb_threat_type;
|
| }
|
|
|
| // Returns the severity information about a given SafeBrowsing list. The lowest
|
| // value is 0, which represents the most severe list.
|
| ThreatSeverity GetThreatSeverity(const ListIdentifier& list_id) {
|
| - switch (list_id.threat_type) {
|
| + switch (list_id.threat_type()) {
|
| case MALWARE_THREAT:
|
| case SOCIAL_ENGINEERING_PUBLIC:
|
| return 0;
|
| @@ -220,13 +213,13 @@ bool V4LocalDatabaseManager::CheckBrowseUrl(const GURL& url, Client* client) {
|
| base::MakeUnique<PendingCheck>(
|
| client, ClientCallbackType::CHECK_BROWSE_URL, url);
|
|
|
| + pending_clients_.insert(client);
|
| +
|
| v4_get_hash_protocol_manager_->GetFullHashes(
|
| full_hash_to_store_and_hash_prefixes,
|
| base::Bind(&V4LocalDatabaseManager::OnFullHashResponse,
|
| base::Unretained(this), base::Passed(&pending_check)));
|
|
|
| - pending_clients_.insert(client);
|
| -
|
| return false;
|
| }
|
| } else {
|
| @@ -271,16 +264,10 @@ void V4LocalDatabaseManager::OnFullHashResponse(
|
| return;
|
| }
|
|
|
| - if (full_hash_infos.empty()) {
|
| - // The resource is not known to be unsafe. Respond right away.
|
| - RespondToClient(std::move(pending_check));
|
| - return;
|
| - }
|
| -
|
| + // Find out the most severe threat, if any, to report to the client.
|
| GetSeverestThreatTypeAndMetadata(&pending_check->result_threat_type,
|
| &pending_check->url_metadata,
|
| full_hash_infos);
|
| -
|
| RespondToClient(std::move(pending_check));
|
| pending_clients_.erase(it);
|
| }
|
|
|