OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "headless/public/util/generic_url_request_job.h" | 5 #include "headless/public/util/generic_url_request_job.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
133 void GenericURLRequestJob::OnFetchStartError(net::Error error) { | 133 void GenericURLRequestJob::OnFetchStartError(net::Error error) { |
134 DispatchStartError(error); | 134 DispatchStartError(error); |
135 } | 135 } |
136 | 136 |
137 void GenericURLRequestJob::OnFetchComplete( | 137 void GenericURLRequestJob::OnFetchComplete( |
138 const GURL& final_url, | 138 const GURL& final_url, |
139 int http_response_code, | 139 int http_response_code, |
140 scoped_refptr<net::HttpResponseHeaders> response_headers, | 140 scoped_refptr<net::HttpResponseHeaders> response_headers, |
141 const char* body, | 141 const char* body, |
142 size_t body_size) { | 142 size_t body_size) { |
143 response_time_ = base::TimeTicks::Now(); | |
143 http_response_code_ = http_response_code; | 144 http_response_code_ = http_response_code; |
144 response_headers_ = response_headers; | 145 response_headers_ = response_headers; |
145 body_ = body; | 146 body_ = body; |
146 body_size_ = body_size; | 147 body_size_ = body_size; |
147 | 148 |
148 DispatchHeadersComplete(); | 149 DispatchHeadersComplete(); |
149 | 150 |
150 std::string mime_type; | 151 std::string mime_type; |
151 GetMimeType(&mime_type); | 152 GetMimeType(&mime_type); |
152 | 153 |
(...skipping 26 matching lines...) Expand all Loading... | |
179 return false; | 180 return false; |
180 return response_headers_->GetMimeType(mime_type); | 181 return response_headers_->GetMimeType(mime_type); |
181 } | 182 } |
182 | 183 |
183 bool GenericURLRequestJob::GetCharset(std::string* charset) { | 184 bool GenericURLRequestJob::GetCharset(std::string* charset) { |
184 if (!response_headers_) | 185 if (!response_headers_) |
185 return false; | 186 return false; |
186 return response_headers_->GetCharset(charset); | 187 return response_headers_->GetCharset(charset); |
187 } | 188 } |
188 | 189 |
190 void GenericURLRequestJob::GetLoadTimingInfo( | |
191 net::LoadTimingInfo* load_timing_info) const { | |
192 load_timing_info->receive_headers_end = response_time_; | |
altimin
2016/11/17 15:45:24
Should we also fill other fields in net::LoadTimin
alex clarke (OOO till 29th)
2016/11/17 16:05:59
Possibly :)
I'm not really sure how they are used
altimin
2016/11/17 16:08:39
Let's add a TODO! :)
| |
193 } | |
194 | |
189 } // namespace headless | 195 } // namespace headless |
OLD | NEW |