| Index: webkit/glue/resource_handle_impl.cc
|
| ===================================================================
|
| --- webkit/glue/resource_handle_impl.cc (revision 15413)
|
| +++ webkit/glue/resource_handle_impl.cc (working copy)
|
| @@ -135,7 +135,8 @@
|
|
|
| static ResourceResponse MakeResourceResponse(
|
| const KURL& kurl,
|
| - const ResourceLoaderBridge::ResponseInfo& info) {
|
| + const ResourceLoaderBridge::ResponseInfo& info,
|
| + const std::string& disposition_fallback_charset) {
|
| int status_code = 0;
|
| long long expected_content_length = info.content_length;
|
| String status_text;
|
| @@ -151,14 +152,13 @@
|
|
|
| // TODO(darin): We should leverage HttpResponseHeaders for this, and this
|
| // should be using the same code as ResourceDispatcherHost.
|
| - // TODO(jungshik): Figure out the actual value of the referrer charset and
|
| - // pass it to GetSuggestedFilename.
|
| std::wstring suggested_filename;
|
| if (info.headers) {
|
| std::string disp_val;
|
| if (info.headers->EnumerateHeader(NULL, "content-disposition", &disp_val)) {
|
| suggested_filename = net::GetSuggestedFilename(
|
| - webkit_glue::KURLToGURL(kurl), disp_val, "", std::wstring());
|
| + webkit_glue::KURLToGURL(kurl), disp_val,
|
| + disposition_fallback_charset, std::wstring());
|
| }
|
| }
|
|
|
| @@ -206,6 +206,12 @@
|
| return response;
|
| }
|
|
|
| +inline static std::string FallbackCharsetForFileName(
|
| + const ResourceRequest& request) {
|
| + return webkit_glue::StringToStdString(
|
| + request.contentDispositionFallbackEncoding());
|
| +}
|
| +
|
| class ResourceHandleInternal : public ResourceLoaderBridge::Peer {
|
| public:
|
| ResourceHandleInternal(ResourceHandle* job, const ResourceRequest& r,
|
| @@ -416,6 +422,8 @@
|
| std::string main_frame_origin =
|
| webkit_glue::StringToStdString(request_.mainDocumentURL().string());
|
|
|
| + std::string fallback_charset = FallbackCharsetForFileName(request_);
|
| +
|
| // TODO(darin): is latin1 really correct here? It is if the strings are
|
| // already ASCII (i.e., if they are already escaped properly).
|
| // TODO(brettw) this should take parameter encoding into account when
|
| @@ -432,7 +440,8 @@
|
| requestor_pid,
|
| FromTargetType(request_.targetType()),
|
| request_.appCacheContextID(),
|
| - request_.requestorID()));
|
| + request_.requestorID(),
|
| + fallback_charset));
|
| if (!bridge_.get())
|
| return false;
|
|
|
| @@ -535,7 +544,9 @@
|
| DCHECK(pending_);
|
|
|
| // TODO(darin): need a way to properly initialize a ResourceResponse
|
| - ResourceResponse response = MakeResourceResponse(request_.url(), info);
|
| + std::string fallback_charset = FallbackCharsetForFileName(request_);
|
| + ResourceResponse response = MakeResourceResponse(request_.url(), info,
|
| + fallback_charset);
|
| response.setIsContentFiltered(content_filtered);
|
|
|
| expected_content_length_ = response.expectedContentLength();
|
| @@ -737,7 +748,8 @@
|
| return;
|
| }
|
|
|
| - response = MakeResourceResponse(kurl, sync_load_response);
|
| + std::string fallback_charset = FallbackCharsetForFileName(request);
|
| + response = MakeResourceResponse(kurl, sync_load_response, fallback_charset);
|
|
|
| data.clear();
|
| data.append(sync_load_response.data.data(),
|
|
|