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

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: fix includes, reorder includes Created 9 years, 10 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/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 32d4a59ad79affb9b2ed020ca2367f18e5c0bcf6..2bd50fb2ea5e339b601bd571a84cdaaf509d262b 100644
--- a/chrome/browser/renderer_host/safe_browsing_resource_handler.cc
+++ b/chrome/browser/renderer_host/safe_browsing_resource_handler.cc
@@ -9,8 +9,9 @@
#include "chrome/browser/renderer_host/resource_dispatcher_host.h"
#include "chrome/browser/renderer_host/resource_message_filter.h"
#include "chrome/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"
// 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
@@ -178,6 +179,21 @@ void SafeBrowsingResourceHandler::StartDisplayingBlockingPage(
GURL original_url;
net::URLRequest* request = rdh_->GetURLRequest(
GlobalRequestID(render_process_host_id_, deferred_request_id_));
+
lzheng 2011/02/22 19:07:18 Instead of putting this logic here, can you move i
gavinp 2011/02/22 22:51:33 Good point Lei! Done. However, the original reas
+ 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);
+ next_handler_->OnResponseCompleted(
cbentzel 2011/02/22 15:56:04 Why do you need to call next_handler_->OnResponseC
gavinp 2011/02/22 22:51:33 Without the call here, the load of the current pag
+ deferred_request_id_,
+ net::URLRequestStatus(net::URLRequestStatus::FAILED, net::ERR_ABORTED),
+ std::string());
+ state_ = STATE_NONE;
+ ClearDeferredRequestInfo();
+ Release();
+ return;
+ }
+
if (request)
original_url = request->original_url();
else

Powered by Google App Engine
This is Rietveld 408576698