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

Unified Diff: content/browser/loader/navigation_resource_handler.cc

Issue 2476163003: Refactor ResourceHandler API. (Closed)
Patch Set: Minor cleanups, one real fix Created 4 years, 1 month 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: content/browser/loader/navigation_resource_handler.cc
diff --git a/content/browser/loader/navigation_resource_handler.cc b/content/browser/loader/navigation_resource_handler.cc
index dc73b854bea71788845ddf9f8114a42eb1427d92..94458f4b9308c44ddb52976dbc4a7669c0339306 100644
--- a/content/browser/loader/navigation_resource_handler.cc
+++ b/content/browser/loader/navigation_resource_handler.cc
@@ -73,10 +73,10 @@ void NavigationResourceHandler::SetController(ResourceController* controller) {
ResourceHandler::SetController(controller);
}
-bool NavigationResourceHandler::OnRequestRedirected(
+void NavigationResourceHandler::OnRequestRedirected(
const net::RedirectInfo& redirect_info,
ResourceResponse* response,
- bool* defer) {
+ bool* defer_or_cancel) {
DCHECK(core_);
// TODO(davidben): Perform a CSP check here, and anything else that would have
@@ -84,12 +84,11 @@ bool NavigationResourceHandler::OnRequestRedirected(
NetLogObserver::PopulateResponseInfo(request(), response);
response->head.encoded_data_length = request()->GetTotalReceivedBytes();
core_->NotifyRequestRedirected(redirect_info, response);
- *defer = true;
- return true;
+ *defer_or_cancel = true;
}
-bool NavigationResourceHandler::OnResponseStarted(ResourceResponse* response,
- bool* defer) {
+void NavigationResourceHandler::OnResponseStarted(ResourceResponse* response,
+ bool* defer_or_cancel) {
DCHECK(core_);
ResourceRequestInfoImpl* info = GetRequestInfo();
@@ -102,7 +101,7 @@ bool NavigationResourceHandler::OnResponseStarted(ResourceResponse* response,
// all the way to the UI thread. Downloads, user certificates, etc., should be
// dispatched at the navigation layer.
if (info->IsDownload())
- return true;
+ return;
StreamContext* stream_context =
GetStreamContextForResourceContext(info->GetContext());
@@ -137,13 +136,11 @@ bool NavigationResourceHandler::OnResponseStarted(ResourceResponse* response,
// does not work as the InterceptingResourceHandler is above us and hence it
// does not expect the old handler to defer the request.
if (!info->is_stream())
- *defer = true;
- return true;
+ *defer_or_cancel = true;
}
-bool NavigationResourceHandler::OnWillStart(const GURL& url, bool* defer) {
- return true;
-}
+void NavigationResourceHandler::OnWillStart(const GURL& url,
+ bool* defer_or_cancel) {}
bool NavigationResourceHandler::OnWillRead(scoped_refptr<net::IOBuffer>* buf,
int* buf_size,
@@ -152,9 +149,9 @@ bool NavigationResourceHandler::OnWillRead(scoped_refptr<net::IOBuffer>* buf,
return true;
}
-bool NavigationResourceHandler::OnReadCompleted(int bytes_read, bool* defer) {
- writer_.OnReadCompleted(bytes_read, defer);
- return true;
+void NavigationResourceHandler::OnReadCompleted(int bytes_read,
+ bool* defer_or_cancel) {
+ writer_.OnReadCompleted(bytes_read, defer_or_cancel);
}
void NavigationResourceHandler::OnResponseCompleted(
« no previous file with comments | « content/browser/loader/navigation_resource_handler.h ('k') | content/browser/loader/redirect_to_file_resource_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698