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

Side by Side Diff: content/browser/loader/navigation_resource_handler.cc

Issue 958083002: PlzNavigate: Show error pages when the navigation failed before commit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@support-data-urls
Patch Set: Updated test Created 5 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/loader/navigation_resource_handler.h" 5 #include "content/browser/loader/navigation_resource_handler.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/browser/devtools/devtools_netlog_observer.h" 8 #include "content/browser/devtools/devtools_netlog_observer.h"
9 #include "content/browser/loader/navigation_url_loader_impl_core.h" 9 #include "content/browser/loader/navigation_url_loader_impl_core.h"
10 #include "content/browser/loader/resource_request_info_impl.h" 10 #include "content/browser/loader/resource_request_info_impl.h"
(...skipping 11 matching lines...) Expand all
22 NavigationResourceHandler::NavigationResourceHandler( 22 NavigationResourceHandler::NavigationResourceHandler(
23 net::URLRequest* request, 23 net::URLRequest* request,
24 NavigationURLLoaderImplCore* core) 24 NavigationURLLoaderImplCore* core)
25 : ResourceHandler(request), 25 : ResourceHandler(request),
26 core_(core) { 26 core_(core) {
27 core_->set_resource_handler(this); 27 core_->set_resource_handler(this);
28 } 28 }
29 29
30 NavigationResourceHandler::~NavigationResourceHandler() { 30 NavigationResourceHandler::~NavigationResourceHandler() {
31 if (core_) { 31 if (core_) {
32 core_->NotifyRequestFailed(net::ERR_ABORTED); 32 core_->NotifyRequestFailed(false, net::ERR_ABORTED);
33 DetachFromCore(); 33 DetachFromCore();
34 } 34 }
35 } 35 }
36 36
37 void NavigationResourceHandler::Cancel() { 37 void NavigationResourceHandler::Cancel() {
38 controller()->Cancel(); 38 controller()->Cancel();
39 core_ = nullptr; 39 core_ = nullptr;
40 } 40 }
41 41
42 void NavigationResourceHandler::FollowRedirect() { 42 void NavigationResourceHandler::FollowRedirect() {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 // 124 //
125 // TODO(davidben): The net error code should be passed through StreamWriter 125 // TODO(davidben): The net error code should be passed through StreamWriter
126 // down to the stream's consumer. See https://crbug.com/426162. 126 // down to the stream's consumer. See https://crbug.com/426162.
127 if (writer_.stream()) { 127 if (writer_.stream()) {
128 writer_.Finalize(); 128 writer_.Finalize();
129 return; 129 return;
130 } 130 }
131 131
132 if (core_) { 132 if (core_) {
133 DCHECK_NE(net::OK, status.error()); 133 DCHECK_NE(net::OK, status.error());
134 core_->NotifyRequestFailed(status.error()); 134 core_->NotifyRequestFailed(request()->response_info().was_cached,
135 status.error());
135 DetachFromCore(); 136 DetachFromCore();
136 } 137 }
137 } 138 }
138 139
139 void NavigationResourceHandler::OnDataDownloaded(int bytes_downloaded) { 140 void NavigationResourceHandler::OnDataDownloaded(int bytes_downloaded) {
140 NOTREACHED(); 141 NOTREACHED();
141 } 142 }
142 143
143 void NavigationResourceHandler::DetachFromCore() { 144 void NavigationResourceHandler::DetachFromCore() {
144 DCHECK(core_); 145 DCHECK(core_);
145 core_->set_resource_handler(nullptr); 146 core_->set_resource_handler(nullptr);
146 core_ = nullptr; 147 core_ = nullptr;
147 } 148 }
148 149
149 } // namespace content 150 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.cc ('k') | content/browser/loader/navigation_url_loader_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698