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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 // The resource may have been supplied in the request. | 128 // The resource may have been supplied in the request. |
129 const HttpResponse* matched_resource = delegate_->MaybeMatchResource( | 129 const HttpResponse* matched_resource = delegate_->MaybeMatchResource( |
130 rewritten_url, devtools_request_id_, method, extra_request_headers_); | 130 rewritten_url, devtools_request_id_, method, extra_request_headers_); |
131 | 131 |
132 if (matched_resource) { | 132 if (matched_resource) { |
133 OnFetchCompleteExtractHeaders( | 133 OnFetchCompleteExtractHeaders( |
134 matched_resource->final_url, matched_resource->http_response_code, | 134 matched_resource->final_url, matched_resource->http_response_code, |
135 matched_resource->response_data, matched_resource->response_data_size); | 135 matched_resource->response_data, matched_resource->response_data_size); |
136 } else { | 136 } else { |
137 url_fetcher_->StartFetch(rewritten_url, method, extra_request_headers_, | 137 url_fetcher_->StartFetch(rewritten_url, method, extra_request_headers_, |
138 this); | 138 devtools_request_id_, this); |
139 } | 139 } |
140 } | 140 } |
141 | 141 |
142 void GenericURLRequestJob::OnFetchStartError(net::Error error) { | 142 void GenericURLRequestJob::OnFetchStartError(net::Error error) { |
143 DispatchStartError(error); | 143 DispatchStartError(error); |
144 } | 144 } |
145 | 145 |
146 void GenericURLRequestJob::OnFetchComplete( | 146 void GenericURLRequestJob::OnFetchComplete( |
147 const GURL& final_url, | 147 const GURL& final_url, |
148 int http_response_code, | 148 int http_response_code, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 return response_headers_->GetCharset(charset); | 197 return response_headers_->GetCharset(charset); |
198 } | 198 } |
199 | 199 |
200 void GenericURLRequestJob::GetLoadTimingInfo( | 200 void GenericURLRequestJob::GetLoadTimingInfo( |
201 net::LoadTimingInfo* load_timing_info) const { | 201 net::LoadTimingInfo* load_timing_info) const { |
202 // TODO(alexclarke): Investigate setting the other members too where possible. | 202 // TODO(alexclarke): Investigate setting the other members too where possible. |
203 load_timing_info->receive_headers_end = response_time_; | 203 load_timing_info->receive_headers_end = response_time_; |
204 } | 204 } |
205 | 205 |
206 } // namespace headless | 206 } // namespace headless |
OLD | NEW |