| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 | 237 |
| 238 response->setHTTPStatusCode(headers->response_code()); | 238 response->setHTTPStatusCode(headers->response_code()); |
| 239 response->setHTTPStatusText(WebString::fromUTF8(headers->GetStatusText())); | 239 response->setHTTPStatusText(WebString::fromUTF8(headers->GetStatusText())); |
| 240 | 240 |
| 241 // TODO(darin): We should leverage HttpResponseHeaders for this, and this | 241 // TODO(darin): We should leverage HttpResponseHeaders for this, and this |
| 242 // should be using the same code as ResourceDispatcherHost. | 242 // should be using the same code as ResourceDispatcherHost. |
| 243 // TODO(jungshik): Figure out the actual value of the referrer charset and | 243 // TODO(jungshik): Figure out the actual value of the referrer charset and |
| 244 // pass it to GetSuggestedFilename. | 244 // pass it to GetSuggestedFilename. |
| 245 std::string value; | 245 std::string value; |
| 246 if (headers->EnumerateHeader(NULL, "content-disposition", &value)) { | 246 if (headers->EnumerateHeader(NULL, "content-disposition", &value)) { |
| 247 response->setSuggestedFileName(FilePathToWebString( | 247 response->setSuggestedFileName( |
| 248 net::GetSuggestedFilename(url, value, "", FilePath()))); | 248 net::GetSuggestedFilename(url, value, "", string16())); |
| 249 } | 249 } |
| 250 | 250 |
| 251 Time time_val; | 251 Time time_val; |
| 252 if (headers->GetLastModifiedValue(&time_val)) | 252 if (headers->GetLastModifiedValue(&time_val)) |
| 253 response->setLastModifiedDate(time_val.ToDoubleT()); | 253 response->setLastModifiedDate(time_val.ToDoubleT()); |
| 254 | 254 |
| 255 // Build up the header map. | 255 // Build up the header map. |
| 256 void* iter = NULL; | 256 void* iter = NULL; |
| 257 std::string name; | 257 std::string name; |
| 258 while (headers->EnumerateHeaderLines(&iter, &name, &value)) { | 258 while (headers->EnumerateHeaderLines(&iter, &name, &value)) { |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 | 750 |
| 751 void WebURLLoaderImpl::cancel() { | 751 void WebURLLoaderImpl::cancel() { |
| 752 context_->Cancel(); | 752 context_->Cancel(); |
| 753 } | 753 } |
| 754 | 754 |
| 755 void WebURLLoaderImpl::setDefersLoading(bool value) { | 755 void WebURLLoaderImpl::setDefersLoading(bool value) { |
| 756 context_->SetDefersLoading(value); | 756 context_->SetDefersLoading(value); |
| 757 } | 757 } |
| 758 | 758 |
| 759 } // namespace webkit_glue | 759 } // namespace webkit_glue |
| OLD | NEW |