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

Unified Diff: chrome/browser/loader/safe_browsing_resource_throttle.cc

Issue 2371043003: Small: Start checking URLs using PVer4. Verdict not returned to client yet. (Closed)
Patch Set: shess@'s review Created 4 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
Index: chrome/browser/loader/safe_browsing_resource_throttle.cc
diff --git a/chrome/browser/loader/safe_browsing_resource_throttle.cc b/chrome/browser/loader/safe_browsing_resource_throttle.cc
index b8a7c538393a10609b71cf8c9f1b59991f6de7f4..38fbf60d9b354a289c78c763c5cf19fbab19643c 100644
--- a/chrome/browser/loader/safe_browsing_resource_throttle.cc
+++ b/chrome/browser/loader/safe_browsing_resource_throttle.cc
@@ -15,6 +15,7 @@
#include "chrome/browser/prerender/prerender_contents.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include "components/safe_browsing_db/util.h"
+#include "components/safe_browsing_db/v4_local_database_manager.h"
#include "components/subresource_filter/content/browser/content_subresource_filter_driver_factory.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_frame_host.h"
@@ -96,7 +97,8 @@ SafeBrowsingResourceThrottle::SafeBrowsingResourceThrottle(
resource_type_(resource_type),
net_log_with_source_(
net::NetLogWithSource::Make(request->net_log().net_log(),
- NetLogSourceType::SAFE_BROWSING)) {}
+ NetLogSourceType::SAFE_BROWSING)),
+ v4_local_database_manager_(sb_service->v4_local_database_manager()) {}
SafeBrowsingResourceThrottle::~SafeBrowsingResourceThrottle() {
if (defer_state_ != DEFERRED_NONE) {
@@ -105,6 +107,10 @@ SafeBrowsingResourceThrottle::~SafeBrowsingResourceThrottle() {
if (state_ == STATE_CHECKING_URL) {
database_manager_->CancelCheck(this);
+ if (v4_local_database_manager_) {
+ v4_local_database_manager_->CancelCheck(this);
+ }
+
EndNetLogEvent(NetLogEventType::SAFE_BROWSING_CHECKING_URL, "result",
"request_canceled");
}
@@ -373,6 +379,11 @@ bool SafeBrowsingResourceThrottle::CheckUrl(const GURL& url) {
UMA_HISTOGRAM_ENUMERATION("SB2.ResourceTypes2.Checked", resource_type_,
content::RESOURCE_TYPE_LAST_TYPE);
+ if (v4_local_database_manager_ &&
+ v4_local_database_manager_->CanCheckResourceType(resource_type_)) {
+ v4_local_database_manager_->CheckBrowseUrl(url, this);
+ }
+
if (succeeded_synchronously) {
threat_type_ = safe_browsing::SB_THREAT_TYPE_SAFE;
ui_manager_->LogPauseDelay(base::TimeDelta()); // No delay.
@@ -398,6 +409,9 @@ void SafeBrowsingResourceThrottle::OnCheckUrlTimeout() {
CHECK_EQ(state_, STATE_CHECKING_URL);
database_manager_->CancelCheck(this);
+ if (v4_local_database_manager_) {
+ v4_local_database_manager_->CancelCheck(this);
+ }
OnCheckBrowseUrlResult(url_being_checked_, safe_browsing::SB_THREAT_TYPE_SAFE,
safe_browsing::ThreatMetadata());
}

Powered by Google App Engine
This is Rietveld 408576698