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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 bool NavigationResourceHandler::OnRequestRedirected( | 69 bool NavigationResourceHandler::OnRequestRedirected( |
70 const net::RedirectInfo& redirect_info, | 70 const net::RedirectInfo& redirect_info, |
71 ResourceResponse* response, | 71 ResourceResponse* response, |
72 bool* defer) { | 72 bool* defer) { |
73 DCHECK(core_); | 73 DCHECK(core_); |
74 | 74 |
75 // TODO(davidben): Perform a CSP check here, and anything else that would have | 75 // TODO(davidben): Perform a CSP check here, and anything else that would have |
76 // been done renderer-side. | 76 // been done renderer-side. |
77 NetLogObserver::PopulateResponseInfo(request(), response); | 77 NetLogObserver::PopulateResponseInfo(request(), response); |
| 78 response->head.encoded_data_length = request()->GetTotalReceivedBytes(); |
78 core_->NotifyRequestRedirected(redirect_info, response); | 79 core_->NotifyRequestRedirected(redirect_info, response); |
79 *defer = true; | 80 *defer = true; |
80 return true; | 81 return true; |
81 } | 82 } |
82 | 83 |
83 bool NavigationResourceHandler::OnResponseStarted(ResourceResponse* response, | 84 bool NavigationResourceHandler::OnResponseStarted(ResourceResponse* response, |
84 bool* defer) { | 85 bool* defer) { |
85 DCHECK(core_); | 86 DCHECK(core_); |
86 | 87 |
87 ResourceRequestInfoImpl* info = GetRequestInfo(); | 88 ResourceRequestInfoImpl* info = GetRequestInfo(); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 NOTREACHED(); | 170 NOTREACHED(); |
170 } | 171 } |
171 | 172 |
172 void NavigationResourceHandler::DetachFromCore() { | 173 void NavigationResourceHandler::DetachFromCore() { |
173 DCHECK(core_); | 174 DCHECK(core_); |
174 core_->set_resource_handler(nullptr); | 175 core_->set_resource_handler(nullptr); |
175 core_ = nullptr; | 176 core_ = nullptr; |
176 } | 177 } |
177 | 178 |
178 } // namespace content | 179 } // namespace content |
OLD | NEW |