| 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 // TODO(alexclarke): Investigate setting the other members too where possible. |
| 193 load_timing_info->receive_headers_end = response_time_; |
| 194 } |
| 195 |
| 189 } // namespace headless | 196 } // namespace headless |
| OLD | NEW |