Index: chrome/browser/safe_browsing/ui_manager.cc |
diff --git a/chrome/browser/safe_browsing/ui_manager.cc b/chrome/browser/safe_browsing/ui_manager.cc |
index 2c58e798f00c0cc29bcb90dfb06886c7c526b662..f6877b96a4f2cb335894acd9a8f5b33d83a5c87e 100644 |
--- a/chrome/browser/safe_browsing/ui_manager.cc |
+++ b/chrome/browser/safe_browsing/ui_manager.cc |
@@ -14,6 +14,7 @@ |
#include "base/threading/thread_restrictions.h" |
#include "chrome/browser/browser_process.h" |
#include "chrome/browser/safe_browsing/malware_details.h" |
+#include "chrome/browser/safe_browsing/metadata.pb.h" |
#include "chrome/browser/safe_browsing/ping_manager.h" |
#include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" |
#include "chrome/browser/safe_browsing/safe_browsing_service.h" |
@@ -96,6 +97,23 @@ void SafeBrowsingUIManager::DisplayBlockingPage( |
const UnsafeResource& resource) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ if (!resource.threat_metadata.empty() && |
+ resource.threat_type == SB_THREAT_TYPE_URL_MALWARE) { |
+ safe_browsing::MalwarePatternType proto; |
+ // Malware sites tagged as "landing site" should only show a warning for a |
+ // main-frame or sub-frame resource. (See "Types of Malware sites" under |
+ // https://developers.google.com/safe-browsing/developers_guide_v3#UserWarnings) |
+ if (proto.ParseFromString(resource.threat_metadata) && |
+ proto.pattern_type() == safe_browsing::MalwarePatternType::LANDING && |
+ resource.is_subresource && !resource.is_subframe) { |
+ if (!resource.callback.is_null()) { |
+ BrowserThread::PostTask( |
+ BrowserThread::IO, FROM_HERE, base::Bind(resource.callback, true)); |
+ } |
+ return; |
+ } |
+ } |
+ |
// Indicate to interested observers that the resource in question matched the |
// SB filters. If the resource is already whitelisted, OnSafeBrowsingHit |
// won't be called. |