OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/child/web_url_loader_impl.h" | 7 #include "content/child/web_url_loader_impl.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <deque> | 10 #include <deque> |
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1062 response->setHTTPStatusCode(headers->response_code()); | 1062 response->setHTTPStatusCode(headers->response_code()); |
1063 response->setHTTPStatusText(WebString::fromLatin1(headers->GetStatusText())); | 1063 response->setHTTPStatusText(WebString::fromLatin1(headers->GetStatusText())); |
1064 | 1064 |
1065 // TODO(darin): We should leverage HttpResponseHeaders for this, and this | 1065 // TODO(darin): We should leverage HttpResponseHeaders for this, and this |
1066 // should be using the same code as ResourceDispatcherHost. | 1066 // should be using the same code as ResourceDispatcherHost. |
1067 // TODO(jungshik): Figure out the actual value of the referrer charset and | 1067 // TODO(jungshik): Figure out the actual value of the referrer charset and |
1068 // pass it to GetSuggestedFilename. | 1068 // pass it to GetSuggestedFilename. |
1069 std::string value; | 1069 std::string value; |
1070 headers->EnumerateHeader(NULL, "content-disposition", &value); | 1070 headers->EnumerateHeader(NULL, "content-disposition", &value); |
1071 response->setSuggestedFileName( | 1071 response->setSuggestedFileName( |
1072 net::GetSuggestedFilename(url, | 1072 net::GenerateFileName(url, value, |
1073 value, | 1073 std::string(), // referrer_charset |
1074 std::string(), // referrer_charset | 1074 std::string(), // suggested_name |
1075 std::string(), // suggested_name | 1075 std::string(), // mime_type |
1076 std::string(), // mime_type | 1076 std::string()).AsUTF16Unsafe()); // default_name |
1077 std::string())); // default_name | |
1078 | 1077 |
1079 Time time_val; | 1078 Time time_val; |
1080 if (headers->GetLastModifiedValue(&time_val)) | 1079 if (headers->GetLastModifiedValue(&time_val)) |
1081 response->setLastModifiedDate(time_val.ToDoubleT()); | 1080 response->setLastModifiedDate(time_val.ToDoubleT()); |
1082 | 1081 |
1083 // Build up the header map. | 1082 // Build up the header map. |
1084 void* iter = NULL; | 1083 void* iter = NULL; |
1085 std::string name; | 1084 std::string name; |
1086 while (headers->EnumerateHeaderLines(&iter, &name, &value)) { | 1085 while (headers->EnumerateHeaderLines(&iter, &name, &value)) { |
1087 response->addHTTPHeaderField(WebString::fromLatin1(name), | 1086 response->addHTTPHeaderField(WebString::fromLatin1(name), |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1135 int intra_priority_value) { | 1134 int intra_priority_value) { |
1136 context_->DidChangePriority(new_priority, intra_priority_value); | 1135 context_->DidChangePriority(new_priority, intra_priority_value); |
1137 } | 1136 } |
1138 | 1137 |
1139 bool WebURLLoaderImpl::attachThreadedDataReceiver( | 1138 bool WebURLLoaderImpl::attachThreadedDataReceiver( |
1140 blink::WebThreadedDataReceiver* threaded_data_receiver) { | 1139 blink::WebThreadedDataReceiver* threaded_data_receiver) { |
1141 return context_->AttachThreadedDataReceiver(threaded_data_receiver); | 1140 return context_->AttachThreadedDataReceiver(threaded_data_receiver); |
1142 } | 1141 } |
1143 | 1142 |
1144 } // namespace content | 1143 } // namespace content |
OLD | NEW |