OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "net/url_request/url_request_http_job.h" | 5 #include "net/url_request/url_request_http_job.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 | 132 |
133 net::LoadState URLRequestHttpJob::GetLoadState() const { | 133 net::LoadState URLRequestHttpJob::GetLoadState() const { |
134 return transaction_.get() ? | 134 return transaction_.get() ? |
135 transaction_->GetLoadState() : net::LOAD_STATE_IDLE; | 135 transaction_->GetLoadState() : net::LOAD_STATE_IDLE; |
136 } | 136 } |
137 | 137 |
138 uint64 URLRequestHttpJob::GetUploadProgress() const { | 138 uint64 URLRequestHttpJob::GetUploadProgress() const { |
139 return transaction_.get() ? transaction_->GetUploadProgress() : 0; | 139 return transaction_.get() ? transaction_->GetUploadProgress() : 0; |
140 } | 140 } |
141 | 141 |
142 bool URLRequestHttpJob::GetMimeType(std::string* mime_type) { | 142 bool URLRequestHttpJob::GetMimeType(std::string* mime_type) const { |
143 DCHECK(transaction_.get()); | 143 DCHECK(transaction_.get()); |
144 | 144 |
145 if (!response_info_) | 145 if (!response_info_) |
146 return false; | 146 return false; |
147 | 147 |
148 return response_info_->headers->GetMimeType(mime_type); | 148 return response_info_->headers->GetMimeType(mime_type); |
149 } | 149 } |
150 | 150 |
151 bool URLRequestHttpJob::GetCharset(std::string* charset) { | 151 bool URLRequestHttpJob::GetCharset(std::string* charset) { |
152 DCHECK(transaction_.get()); | 152 DCHECK(transaction_.get()); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 std::string encoding_type; | 199 std::string encoding_type; |
200 void* iter = NULL; | 200 void* iter = NULL; |
201 while (response_info_->headers->EnumerateHeader(&iter, "Content-Encoding", | 201 while (response_info_->headers->EnumerateHeader(&iter, "Content-Encoding", |
202 &encoding_type)) { | 202 &encoding_type)) { |
203 encoding_types->push_back(Filter::ConvertEncodingToType(encoding_type)); | 203 encoding_types->push_back(Filter::ConvertEncodingToType(encoding_type)); |
204 } | 204 } |
205 | 205 |
206 if (!encoding_types->empty()) { | 206 if (!encoding_types->empty()) { |
207 std::string mime_type; | 207 std::string mime_type; |
208 GetMimeType(&mime_type); | 208 GetMimeType(&mime_type); |
| 209 // TODO(jar): Need to change this call to use the FilterContext interfaces. |
209 Filter::FixupEncodingTypes(IsSdchResponse(), mime_type, encoding_types); | 210 Filter::FixupEncodingTypes(IsSdchResponse(), mime_type, encoding_types); |
210 } | 211 } |
211 return !encoding_types->empty(); | 212 return !encoding_types->empty(); |
212 } | 213 } |
213 | 214 |
214 bool URLRequestHttpJob::IsSdchResponse() const { | 215 bool URLRequestHttpJob::IsSdchResponse() const { |
215 return response_info_ && | 216 return response_info_ && |
216 (request_info_.load_flags & net::LOAD_SDCH_DICTIONARY_ADVERTISED); | 217 (request_info_.load_flags & net::LOAD_SDCH_DICTIONARY_ADVERTISED); |
217 } | 218 } |
218 | 219 |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 DCHECK(response_cookies_.empty()); | 571 DCHECK(response_cookies_.empty()); |
571 | 572 |
572 std::string name = "Set-Cookie"; | 573 std::string name = "Set-Cookie"; |
573 std::string value; | 574 std::string value; |
574 | 575 |
575 void* iter = NULL; | 576 void* iter = NULL; |
576 while (response_info_->headers->EnumerateHeader(&iter, name, &value)) | 577 while (response_info_->headers->EnumerateHeader(&iter, name, &value)) |
577 response_cookies_.push_back(value); | 578 response_cookies_.push_back(value); |
578 } | 579 } |
579 | 580 |
OLD | NEW |