| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "content/browser/streams/stream_url_request_job.h" | 5 #include "content/browser/streams/stream_url_request_job.h" |
| 6 | 6 |
| 7 #include "base/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
| 8 #include "content/browser/streams/stream.h" | 8 #include "content/browser/streams/stream.h" |
| 9 #include "net/base/io_buffer.h" | 9 #include "net/base/io_buffer.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 pending_buffer_ = buf; | 110 pending_buffer_ = buf; |
| 111 pending_buffer_size_ = to_read; | 111 pending_buffer_size_ = to_read; |
| 112 SetStatus(net::URLRequestStatus(net::URLRequestStatus::IO_PENDING, 0)); | 112 SetStatus(net::URLRequestStatus(net::URLRequestStatus::IO_PENDING, 0)); |
| 113 return false; | 113 return false; |
| 114 } | 114 } |
| 115 NOTREACHED(); | 115 NOTREACHED(); |
| 116 return false; | 116 return false; |
| 117 } | 117 } |
| 118 | 118 |
| 119 bool StreamURLRequestJob::GetMimeType(std::string* mime_type) const { | 119 bool StreamURLRequestJob::GetMimeType(std::string* mime_type) const { |
| 120 if (!response_info_.get()) | 120 if (!response_info_) |
| 121 return false; | 121 return false; |
| 122 | 122 |
| 123 // TODO(zork): Support registered MIME types if needed. | 123 // TODO(zork): Support registered MIME types if needed. |
| 124 return response_info_->headers->GetMimeType(mime_type); | 124 return response_info_->headers->GetMimeType(mime_type); |
| 125 } | 125 } |
| 126 | 126 |
| 127 void StreamURLRequestJob::GetResponseInfo(net::HttpResponseInfo* info) { | 127 void StreamURLRequestJob::GetResponseInfo(net::HttpResponseInfo* info) { |
| 128 if (response_info_.get()) | 128 if (response_info_) |
| 129 *info = *response_info_; | 129 *info = *response_info_; |
| 130 } | 130 } |
| 131 | 131 |
| 132 int StreamURLRequestJob::GetResponseCode() const { | 132 int StreamURLRequestJob::GetResponseCode() const { |
| 133 if (!response_info_.get()) | 133 if (!response_info_) |
| 134 return -1; | 134 return -1; |
| 135 | 135 |
| 136 return response_info_->headers->response_code(); | 136 return response_info_->headers->response_code(); |
| 137 } | 137 } |
| 138 | 138 |
| 139 void StreamURLRequestJob::SetExtraRequestHeaders( | 139 void StreamURLRequestJob::SetExtraRequestHeaders( |
| 140 const net::HttpRequestHeaders& headers) { | 140 const net::HttpRequestHeaders& headers) { |
| 141 std::string range_header; | 141 std::string range_header; |
| 142 if (headers.GetHeader(net::HttpRequestHeaders::kRange, &range_header)) { | 142 if (headers.GetHeader(net::HttpRequestHeaders::kRange, &range_header)) { |
| 143 std::vector<net::HttpByteRange> ranges; | 143 std::vector<net::HttpByteRange> ranges; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 } | 234 } |
| 235 | 235 |
| 236 void StreamURLRequestJob::ClearStream() { | 236 void StreamURLRequestJob::ClearStream() { |
| 237 if (stream_) { | 237 if (stream_) { |
| 238 stream_->RemoveReadObserver(this); | 238 stream_->RemoveReadObserver(this); |
| 239 stream_ = NULL; | 239 stream_ = NULL; |
| 240 } | 240 } |
| 241 } | 241 } |
| 242 | 242 |
| 243 } // namespace content | 243 } // namespace content |
| OLD | NEW |