| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "android_webview/browser/net/android_stream_reader_url_request_job.h" | 5 #include "android_webview/browser/net/android_stream_reader_url_request_job.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "android_webview/browser/input_stream.h" | 9 #include "android_webview/browser/input_stream.h" |
| 10 #include "android_webview/browser/net/input_stream_reader.h" | 10 #include "android_webview/browser/net/input_stream_reader.h" |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 | 317 |
| 318 std::string mime_type; | 318 std::string mime_type; |
| 319 if (GetMimeType(&mime_type) && !mime_type.empty()) { | 319 if (GetMimeType(&mime_type) && !mime_type.empty()) { |
| 320 std::string content_type_header(net::HttpRequestHeaders::kContentType); | 320 std::string content_type_header(net::HttpRequestHeaders::kContentType); |
| 321 content_type_header.append(": "); | 321 content_type_header.append(": "); |
| 322 content_type_header.append(mime_type); | 322 content_type_header.append(mime_type); |
| 323 headers->AddHeader(content_type_header); | 323 headers->AddHeader(content_type_header); |
| 324 } | 324 } |
| 325 } | 325 } |
| 326 | 326 |
| 327 JNIEnv* env = AttachCurrentThread(); |
| 328 DCHECK(env); |
| 329 delegate_->UpdateHeaders(env, headers); |
| 330 |
| 327 // Indicate that the response had been obtained via shouldInterceptRequest. | 331 // Indicate that the response had been obtained via shouldInterceptRequest. |
| 328 headers->AddHeader(kResponseHeaderViaShouldInterceptRequest); | 332 headers->AddHeader(kResponseHeaderViaShouldInterceptRequest); |
| 329 | 333 |
| 330 response_info_.reset(new net::HttpResponseInfo()); | 334 response_info_.reset(new net::HttpResponseInfo()); |
| 331 response_info_->headers = headers; | 335 response_info_->headers = headers; |
| 332 | 336 |
| 333 NotifyHeadersComplete(); | 337 NotifyHeadersComplete(); |
| 334 } | 338 } |
| 335 | 339 |
| 336 int AndroidStreamReaderURLRequestJob::GetResponseCode() const { | 340 int AndroidStreamReaderURLRequestJob::GetResponseCode() const { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 358 } else { | 362 } else { |
| 359 // We don't support multiple range requests in one single URL request, | 363 // We don't support multiple range requests in one single URL request, |
| 360 // because we need to do multipart encoding here. | 364 // because we need to do multipart encoding here. |
| 361 NotifyDone(net::URLRequestStatus( | 365 NotifyDone(net::URLRequestStatus( |
| 362 net::URLRequestStatus::FAILED, | 366 net::URLRequestStatus::FAILED, |
| 363 net::ERR_REQUEST_RANGE_NOT_SATISFIABLE)); | 367 net::ERR_REQUEST_RANGE_NOT_SATISFIABLE)); |
| 364 } | 368 } |
| 365 } | 369 } |
| 366 } | 370 } |
| 367 } | 371 } |
| OLD | NEW |