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 // This file replaces WebCore/platform/network/win/ResourceHandleWin.cpp with a | 5 // This file replaces WebCore/platform/network/win/ResourceHandleWin.cpp with a |
6 // platform-neutral implementation that simply defers almost entirely to | 6 // platform-neutral implementation that simply defers almost entirely to |
7 // ResouceLoaderBridge. | 7 // ResouceLoaderBridge. |
8 // | 8 // |
9 // This uses the same ResourceHandle.h header file that the rest of WebKit | 9 // This uses the same ResourceHandle.h header file that the rest of WebKit |
10 // uses, allowing us to avoid complicated changes. Our specific things are | 10 // uses, allowing us to avoid complicated changes. Our specific things are |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 // It's okay if there are no headers | 144 // It's okay if there are no headers |
145 if (info.headers) | 145 if (info.headers) |
146 ExtractInfoFromHeaders(info.headers, | 146 ExtractInfoFromHeaders(info.headers, |
147 &header_map, | 147 &header_map, |
148 &status_code, | 148 &status_code, |
149 &status_text, | 149 &status_text, |
150 &expected_content_length); | 150 &expected_content_length); |
151 | 151 |
152 // TODO(darin): We should leverage HttpResponseHeaders for this, and this | 152 // TODO(darin): We should leverage HttpResponseHeaders for this, and this |
153 // should be using the same code as ResourceDispatcherHost. | 153 // should be using the same code as ResourceDispatcherHost. |
| 154 // TODO(jungshik): Figure out the actual value of the referrer charset and |
| 155 // pass it to GetSuggestedFilename. |
154 std::wstring suggested_filename; | 156 std::wstring suggested_filename; |
155 if (info.headers) { | 157 if (info.headers) { |
156 std::string disp_val; | 158 std::string disp_val; |
157 if (info.headers->EnumerateHeader(NULL, "content-disposition", &disp_val)) { | 159 if (info.headers->EnumerateHeader(NULL, "content-disposition", &disp_val)) { |
158 suggested_filename = net::GetSuggestedFilename( | 160 suggested_filename = net::GetSuggestedFilename( |
159 webkit_glue::KURLToGURL(kurl), disp_val, std::wstring()); | 161 webkit_glue::KURLToGURL(kurl), disp_val, "", std::wstring()); |
160 } | 162 } |
161 } | 163 } |
162 | 164 |
163 ResourceResponse response(kurl, | 165 ResourceResponse response(kurl, |
164 webkit_glue::StdStringToString(info.mime_type), | 166 webkit_glue::StdStringToString(info.mime_type), |
165 expected_content_length, | 167 expected_content_length, |
166 webkit_glue::StdStringToString(info.charset), | 168 webkit_glue::StdStringToString(info.charset), |
167 webkit_glue::StdWStringToString(suggested_filename)); | 169 webkit_glue::StdWStringToString(suggested_filename)); |
168 | 170 |
169 if (info.headers) { | 171 if (info.headers) { |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 // if the request cannot be serviced from cache. We force the 'DontLoad' | 756 // if the request cannot be serviced from cache. We force the 'DontLoad' |
755 // cache policy at this point to ensure that we never hit the network for | 757 // cache policy at this point to ensure that we never hit the network for |
756 // this request. | 758 // this request. |
757 // | 759 // |
758 DCHECK(request.httpMethod() == "POST"); | 760 DCHECK(request.httpMethod() == "POST"); |
759 request.setCachePolicy(ReturnCacheDataDontLoad); | 761 request.setCachePolicy(ReturnCacheDataDontLoad); |
760 return true; | 762 return true; |
761 } | 763 } |
762 | 764 |
763 } // namespace WebCore | 765 } // namespace WebCore |
OLD | NEW |