summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/renderer_host/safe_browsing_resource_handler.cc9
-rw-r--r--chrome/browser/renderer_host/safe_browsing_resource_handler.h3
2 files changed, 10 insertions, 2 deletions
diff --git a/chrome/browser/renderer_host/safe_browsing_resource_handler.cc b/chrome/browser/renderer_host/safe_browsing_resource_handler.cc
index 958df73..f8691f0 100644
--- a/chrome/browser/renderer_host/safe_browsing_resource_handler.cc
+++ b/chrome/browser/renderer_host/safe_browsing_resource_handler.cc
@@ -130,12 +130,12 @@ bool SafeBrowsingResourceHandler::OnReadCompleted(int request_id,
bool SafeBrowsingResourceHandler::OnResponseCompleted(
int request_id, const URLRequestStatus& status,
const std::string& security_info) {
- CHECK(state_ == STATE_NONE);
- CHECK(defer_state_ == DEFERRED_NONE);
+ Shutdown();
return next_handler_->OnResponseCompleted(request_id, status, security_info);
}
void SafeBrowsingResourceHandler::OnRequestClosed() {
+ Shutdown();
next_handler_->OnRequestClosed();
}
@@ -201,7 +201,12 @@ void SafeBrowsingResourceHandler::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
DCHECK(type.value == NotificationType::RESOURCE_MESSAGE_FILTER_SHUTDOWN);
+ Shutdown();
+}
+
+void SafeBrowsingResourceHandler::Shutdown() {
if (state_ == STATE_CHECKING_URL) {
+ timer_.Stop();
safe_browsing_->CancelCheck(this);
state_ = STATE_NONE;
// Balance the AddRef() from CheckUrl() which would ordinarily be
diff --git a/chrome/browser/renderer_host/safe_browsing_resource_handler.h b/chrome/browser/renderer_host/safe_browsing_resource_handler.h
index e34f74f..b113635 100644
--- a/chrome/browser/renderer_host/safe_browsing_resource_handler.h
+++ b/chrome/browser/renderer_host/safe_browsing_resource_handler.h
@@ -94,6 +94,9 @@ class SafeBrowsingResourceHandler : public ResourceHandler,
~SafeBrowsingResourceHandler();
+ // Cancels any in progress safe browsing actions.
+ void Shutdown();
+
// Starts running |url| through the safe browsing check. Returns true if the
// URL is safe to visit. Otherwise returns false and will call
// OnUrlCheckResult() when the check has completed.