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 // An implementation of WebURLLoader in terms of ResourceLoaderBridge. | 5 // An implementation of WebURLLoader in terms of ResourceLoaderBridge. |
6 | 6 |
7 #include "webkit/glue/weburlloader_impl.h" | 7 #include "webkit/glue/weburlloader_impl.h" |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
222 load_info.addResponseHeader(WebString::fromUTF8(it->first), | 222 load_info.addResponseHeader(WebString::fromUTF8(it->first), |
223 WebString::fromUTF8(it->second)); | 223 WebString::fromUTF8(it->second)); |
224 } | 224 } |
225 response->setHTTPLoadInfo(load_info); | 225 response->setHTTPLoadInfo(load_info); |
226 } | 226 } |
227 | 227 |
228 const net::HttpResponseHeaders* headers = info.headers; | 228 const net::HttpResponseHeaders* headers = info.headers; |
229 if (!headers) | 229 if (!headers) |
230 return; | 230 return; |
231 | 231 |
232 WebURLResponse::HTTPVersion version = WebURLResponse::Unknown; | |
233 if (headers->GetHttpVersion() == net::HttpVersion(0, 9)) | |
234 version = WebURLResponse::HTTP_0_9; | |
235 else if (headers->GetHttpVersion() == net::HttpVersion(1, 0)) | |
236 version = WebURLResponse::HTTP_1_0; | |
237 else if (headers->GetHttpVersion() == net::HttpVersion(1, 1)) | |
darin (slow to review)
2012/05/21 23:39:07
you should probably complain if GetHttpVersion() r
Ami GONE FROM CHROMIUM
2012/05/21 23:49:23
What kind of complaint did you have in mind?
(no
| |
238 version = WebURLResponse::HTTP_1_1; | |
239 response->setHTTPVersion(version); | |
232 response->setHTTPStatusCode(headers->response_code()); | 240 response->setHTTPStatusCode(headers->response_code()); |
233 response->setHTTPStatusText(WebString::fromUTF8(headers->GetStatusText())); | 241 response->setHTTPStatusText(WebString::fromUTF8(headers->GetStatusText())); |
234 | 242 |
235 // TODO(darin): We should leverage HttpResponseHeaders for this, and this | 243 // TODO(darin): We should leverage HttpResponseHeaders for this, and this |
236 // should be using the same code as ResourceDispatcherHost. | 244 // should be using the same code as ResourceDispatcherHost. |
237 // TODO(jungshik): Figure out the actual value of the referrer charset and | 245 // TODO(jungshik): Figure out the actual value of the referrer charset and |
238 // pass it to GetSuggestedFilename. | 246 // pass it to GetSuggestedFilename. |
239 std::string value; | 247 std::string value; |
240 if (headers->EnumerateHeader(NULL, "content-disposition", &value)) { | 248 if (headers->EnumerateHeader(NULL, "content-disposition", &value)) { |
241 response->setSuggestedFileName( | 249 response->setSuggestedFileName( |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
760 | 768 |
761 void WebURLLoaderImpl::setDefersLoading(bool value) { | 769 void WebURLLoaderImpl::setDefersLoading(bool value) { |
762 context_->SetDefersLoading(value); | 770 context_->SetDefersLoading(value); |
763 } | 771 } |
764 | 772 |
765 void WebURLLoaderImpl::UpdateRoutingId(int new_routing_id) { | 773 void WebURLLoaderImpl::UpdateRoutingId(int new_routing_id) { |
766 context_->UpdateRoutingId(new_routing_id); | 774 context_->UpdateRoutingId(new_routing_id); |
767 } | 775 } |
768 | 776 |
769 } // namespace webkit_glue | 777 } // namespace webkit_glue |
OLD | NEW |