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

Unified Diff: chrome/browser/safe_browsing/ui_manager.cc

Issue 586793003: Safebrowsing: Honor the metadata from malware fullhash results in SB API 3.0. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: changes for sky Created 6 years, 3 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
« no previous file with comments | « chrome/browser/safe_browsing/ui_manager.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « chrome/browser/safe_browsing/ui_manager.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698