Chromium Code Reviews| 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/location.h" | 7 #include "base/location.h" |
| 8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 131 | 131 |
| 132 // TODO(zork): Support registered MIME types if needed. | 132 // TODO(zork): Support registered MIME types if needed. |
| 133 return response_info_->headers->GetMimeType(mime_type); | 133 return response_info_->headers->GetMimeType(mime_type); |
| 134 } | 134 } |
| 135 | 135 |
| 136 void StreamURLRequestJob::GetResponseInfo(net::HttpResponseInfo* info) { | 136 void StreamURLRequestJob::GetResponseInfo(net::HttpResponseInfo* info) { |
| 137 if (response_info_) | 137 if (response_info_) |
| 138 *info = *response_info_; | 138 *info = *response_info_; |
| 139 } | 139 } |
| 140 | 140 |
| 141 int StreamURLRequestJob::GetResponseCode() const { | |
| 142 if (!response_info_) | |
| 143 return -1; | |
| 144 | |
| 145 return response_info_->headers->response_code(); | |
| 146 } | |
| 147 | |
|
tyoshino (SeeGerritForStatus)
2017/04/18 05:06:54
OK, but it looks URLRequestJob looks at URLRequest
| |
| 148 int64_t StreamURLRequestJob::GetTotalReceivedBytes() const { | 141 int64_t StreamURLRequestJob::GetTotalReceivedBytes() const { |
| 149 int64_t total_received_bytes = 0; | 142 int64_t total_received_bytes = 0; |
| 150 if (response_info_) | 143 if (response_info_) |
| 151 total_received_bytes = response_info_->headers->raw_headers().size(); | 144 total_received_bytes = response_info_->headers->raw_headers().size(); |
| 152 if (stream_.get()) | 145 if (stream_.get()) |
| 153 total_received_bytes += total_bytes_read_; | 146 total_received_bytes += total_bytes_read_; |
| 154 return total_received_bytes; | 147 return total_received_bytes; |
| 155 } | 148 } |
| 156 | 149 |
| 157 void StreamURLRequestJob::DidStart() { | 150 void StreamURLRequestJob::DidStart() { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 226 } | 219 } |
| 227 | 220 |
| 228 void StreamURLRequestJob::ClearStream() { | 221 void StreamURLRequestJob::ClearStream() { |
| 229 if (stream_.get()) { | 222 if (stream_.get()) { |
| 230 stream_->RemoveReadObserver(this); | 223 stream_->RemoveReadObserver(this); |
| 231 stream_ = NULL; | 224 stream_ = NULL; |
| 232 } | 225 } |
| 233 } | 226 } |
| 234 | 227 |
| 235 } // namespace content | 228 } // namespace content |
| OLD | NEW |