| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 | 160 |
| 161 response->setHTTPStatusCode(headers->response_code()); | 161 response->setHTTPStatusCode(headers->response_code()); |
| 162 response->setHTTPStatusText(StdStringToWebString(headers->GetStatusText())); | 162 response->setHTTPStatusText(StdStringToWebString(headers->GetStatusText())); |
| 163 | 163 |
| 164 // TODO(darin): We should leverage HttpResponseHeaders for this, and this | 164 // TODO(darin): We should leverage HttpResponseHeaders for this, and this |
| 165 // should be using the same code as ResourceDispatcherHost. | 165 // should be using the same code as ResourceDispatcherHost. |
| 166 // TODO(jungshik): Figure out the actual value of the referrer charset and | 166 // TODO(jungshik): Figure out the actual value of the referrer charset and |
| 167 // pass it to GetSuggestedFilename. | 167 // pass it to GetSuggestedFilename. |
| 168 std::string value; | 168 std::string value; |
| 169 if (headers->EnumerateHeader(NULL, "content-disposition", &value)) { | 169 if (headers->EnumerateHeader(NULL, "content-disposition", &value)) { |
| 170 response->setSuggestedFileName(WideToUTF16Hack( | 170 #if defined(OS_WIN) |
| 171 net::GetSuggestedFilename(url, value, "", std::wstring()))); | 171 response->setSuggestedFileName( |
| 172 net::GetSuggestedFilename(url, value, "", "").value()); |
| 173 #else |
| 174 response->setSuggestedFileName(UTF8ToUTF16( |
| 175 net::GetSuggestedFilename(url, value, "", "").value())); |
| 176 #endif |
| 172 } | 177 } |
| 173 | 178 |
| 174 Time time_val; | 179 Time time_val; |
| 175 if (headers->GetLastModifiedValue(&time_val)) | 180 if (headers->GetLastModifiedValue(&time_val)) |
| 176 response->setLastModifiedDate(time_val.ToDoubleT()); | 181 response->setLastModifiedDate(time_val.ToDoubleT()); |
| 177 | 182 |
| 178 // Build up the header map. | 183 // Build up the header map. |
| 179 void* iter = NULL; | 184 void* iter = NULL; |
| 180 std::string name; | 185 std::string name; |
| 181 while (headers->EnumerateHeaderLines(&iter, &name, &value)) { | 186 while (headers->EnumerateHeaderLines(&iter, &name, &value)) { |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 | 587 |
| 583 void WebURLLoaderImpl::cancel() { | 588 void WebURLLoaderImpl::cancel() { |
| 584 context_->Cancel(); | 589 context_->Cancel(); |
| 585 } | 590 } |
| 586 | 591 |
| 587 void WebURLLoaderImpl::setDefersLoading(bool value) { | 592 void WebURLLoaderImpl::setDefersLoading(bool value) { |
| 588 context_->SetDefersLoading(value); | 593 context_->SetDefersLoading(value); |
| 589 } | 594 } |
| 590 | 595 |
| 591 } // namespace webkit_glue | 596 } // namespace webkit_glue |
| OLD | NEW |