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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "content/browser/loader/navigation_url_loader_impl_core.h" | 10 #include "content/browser/loader/navigation_url_loader_impl_core.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 78 |
79 bool NavigationResourceHandler::OnRequestRedirected( | 79 bool NavigationResourceHandler::OnRequestRedirected( |
80 const net::RedirectInfo& redirect_info, | 80 const net::RedirectInfo& redirect_info, |
81 ResourceResponse* response, | 81 ResourceResponse* response, |
82 bool* defer) { | 82 bool* defer) { |
83 DCHECK(core_); | 83 DCHECK(core_); |
84 | 84 |
85 // TODO(davidben): Perform a CSP check here, and anything else that would have | 85 // TODO(davidben): Perform a CSP check here, and anything else that would have |
86 // been done renderer-side. | 86 // been done renderer-side. |
87 NetLogObserver::PopulateResponseInfo(request(), response); | 87 NetLogObserver::PopulateResponseInfo(request(), response); |
| 88 response->head.encoded_data_length = request()->GetTotalReceivedBytes(); |
88 core_->NotifyRequestRedirected(redirect_info, response); | 89 core_->NotifyRequestRedirected(redirect_info, response); |
89 *defer = true; | 90 *defer = true; |
90 return true; | 91 return true; |
91 } | 92 } |
92 | 93 |
93 bool NavigationResourceHandler::OnResponseStarted(ResourceResponse* response, | 94 bool NavigationResourceHandler::OnResponseStarted(ResourceResponse* response, |
94 bool* defer) { | 95 bool* defer) { |
95 DCHECK(core_); | 96 DCHECK(core_); |
96 | 97 |
97 ResourceRequestInfoImpl* info = GetRequestInfo(); | 98 ResourceRequestInfoImpl* info = GetRequestInfo(); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 NOTREACHED(); | 178 NOTREACHED(); |
178 } | 179 } |
179 | 180 |
180 void NavigationResourceHandler::DetachFromCore() { | 181 void NavigationResourceHandler::DetachFromCore() { |
181 DCHECK(core_); | 182 DCHECK(core_); |
182 core_->set_resource_handler(nullptr); | 183 core_->set_resource_handler(nullptr); |
183 core_ = nullptr; | 184 core_ = nullptr; |
184 } | 185 } |
185 | 186 |
186 } // namespace content | 187 } // namespace content |
OLD | NEW |