| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |