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

Unified Diff: chrome/browser/renderer_host/safe_browsing_resource_handler.cc

Issue 6334131: Turn off safebrowsing for PREFETCH requests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clean up unit test, per pending fix to 75507 Created 9 years, 9 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 | « no previous file | chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_host/safe_browsing_resource_handler.cc
diff --git a/chrome/browser/renderer_host/safe_browsing_resource_handler.cc b/chrome/browser/renderer_host/safe_browsing_resource_handler.cc
index f708c81227f2740805f86084f777f9c170a0b3dc..c40d52fbda0dffa70f4a71c4d4d9449f62ede7eb 100644
--- a/chrome/browser/renderer_host/safe_browsing_resource_handler.cc
+++ b/chrome/browser/renderer_host/safe_browsing_resource_handler.cc
@@ -9,8 +9,10 @@
#include "content/browser/renderer_host/resource_dispatcher_host.h"
#include "content/browser/renderer_host/resource_message_filter.h"
#include "content/common/resource_response.h"
-#include "net/base/net_errors.h"
#include "net/base/io_buffer.h"
+#include "net/base/load_flags.h"
+#include "net/base/net_errors.h"
+#include "net/url_request/url_request.h"
// Maximum time in milliseconds to wait for the safe browsing service to
// verify a URL. After this amount of time the outstanding check will be
@@ -158,7 +160,15 @@ void SafeBrowsingResourceHandler::OnBrowseUrlCheckResult(
// Continue the request.
ResumeRequest();
} else {
- StartDisplayingBlockingPage(url, result);
+ const net::URLRequest* request = rdh_->GetURLRequest(
+ GlobalRequestID(render_process_host_id_, deferred_request_id_));
+ if (request->load_flags() & net::LOAD_PREFETCH) {
+ // Don't prefetch resources that fail safe browsing, disallow
+ // them.
+ rdh_->CancelRequest(render_process_host_id_, deferred_request_id_, false);
+ } else {
+ StartDisplayingBlockingPage(url, result);
+ }
}
Release(); // Balances the AddRef() in CheckingUrl().
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698