| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 119 |
| 120 if (matched_resource) { | 120 if (matched_resource) { |
| 121 OnFetchCompleteExtractHeaders( | 121 OnFetchCompleteExtractHeaders( |
| 122 matched_resource->final_url, matched_resource->http_response_code, | 122 matched_resource->final_url, matched_resource->http_response_code, |
| 123 matched_resource->response_data, matched_resource->response_data_size); | 123 matched_resource->response_data, matched_resource->response_data_size); |
| 124 } else { | 124 } else { |
| 125 url_fetcher_->StartFetch(rewritten_url, extra_request_headers_, this); | 125 url_fetcher_->StartFetch(rewritten_url, extra_request_headers_, this); |
| 126 } | 126 } |
| 127 } | 127 } |
| 128 | 128 |
| 129 void GenericURLRequestJob::OnStartError(net::Error error) { | 129 void GenericURLRequestJob::OnFetchStartError(net::Error error) { |
| 130 DispatchStartError(error); | 130 OnStartError(error); |
| 131 } | 131 } |
| 132 | 132 |
| 133 void GenericURLRequestJob::OnFetchComplete( | 133 void GenericURLRequestJob::OnFetchComplete( |
| 134 const GURL& final_url, | 134 const GURL& final_url, |
| 135 int http_response_code, | 135 int http_response_code, |
| 136 scoped_refptr<net::HttpResponseHeaders> response_headers, | 136 scoped_refptr<net::HttpResponseHeaders> response_headers, |
| 137 const char* body, | 137 const char* body, |
| 138 size_t body_size) { | 138 size_t body_size) { |
| 139 http_response_code_ = http_response_code; | 139 http_response_code_ = http_response_code; |
| 140 response_headers_ = response_headers; | 140 response_headers_ = response_headers; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 return response_headers_->GetMimeType(mime_type); | 176 return response_headers_->GetMimeType(mime_type); |
| 177 } | 177 } |
| 178 | 178 |
| 179 bool GenericURLRequestJob::GetCharset(std::string* charset) { | 179 bool GenericURLRequestJob::GetCharset(std::string* charset) { |
| 180 if (!response_headers_) | 180 if (!response_headers_) |
| 181 return false; | 181 return false; |
| 182 return response_headers_->GetCharset(charset); | 182 return response_headers_->GetCharset(charset); |
| 183 } | 183 } |
| 184 | 184 |
| 185 } // namespace headless | 185 } // namespace headless |
| OLD | NEW |