Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(428)

Side by Side Diff: webkit/glue/weburlloader_impl.cc

Issue 367003: Enable localization of default downloaded filename. (Closed)
Patch Set: Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/base/net_util_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/file_path.h"
9 #include "base/message_loop.h" 10 #include "base/message_loop.h"
10 #include "base/process_util.h" 11 #include "base/process_util.h"
11 #include "base/string_util.h" 12 #include "base/string_util.h"
12 #include "base/time.h" 13 #include "base/time.h"
13 #include "net/base/data_url.h" 14 #include "net/base/data_url.h"
14 #include "net/base/load_flags.h" 15 #include "net/base/load_flags.h"
15 #include "net/base/net_errors.h" 16 #include "net/base/net_errors.h"
16 #include "net/base/net_util.h" 17 #include "net/base/net_util.h"
17 #include "net/http/http_response_headers.h" 18 #include "net/http/http_response_headers.h"
18 #include "webkit/api/public/WebHTTPHeaderVisitor.h" 19 #include "webkit/api/public/WebHTTPHeaderVisitor.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 161
161 response->setHTTPStatusCode(headers->response_code()); 162 response->setHTTPStatusCode(headers->response_code());
162 response->setHTTPStatusText(StdStringToWebString(headers->GetStatusText())); 163 response->setHTTPStatusText(StdStringToWebString(headers->GetStatusText()));
163 164
164 // TODO(darin): We should leverage HttpResponseHeaders for this, and this 165 // TODO(darin): We should leverage HttpResponseHeaders for this, and this
165 // should be using the same code as ResourceDispatcherHost. 166 // should be using the same code as ResourceDispatcherHost.
166 // TODO(jungshik): Figure out the actual value of the referrer charset and 167 // TODO(jungshik): Figure out the actual value of the referrer charset and
167 // pass it to GetSuggestedFilename. 168 // pass it to GetSuggestedFilename.
168 std::string value; 169 std::string value;
169 if (headers->EnumerateHeader(NULL, "content-disposition", &value)) { 170 if (headers->EnumerateHeader(NULL, "content-disposition", &value)) {
170 #if defined(OS_WIN) 171 response->setSuggestedFileName(webkit_glue::FilePathToWebString(
171 response->setSuggestedFileName( 172 net::GetSuggestedFilename(url, value, "", FilePath())));
172 net::GetSuggestedFilename(url, value, "", "").value());
173 #else
174 response->setSuggestedFileName(UTF8ToUTF16(
175 net::GetSuggestedFilename(url, value, "", "").value()));
176 #endif
177 } 173 }
178 174
179 Time time_val; 175 Time time_val;
180 if (headers->GetLastModifiedValue(&time_val)) 176 if (headers->GetLastModifiedValue(&time_val))
181 response->setLastModifiedDate(time_val.ToDoubleT()); 177 response->setLastModifiedDate(time_val.ToDoubleT());
182 178
183 // Build up the header map. 179 // Build up the header map.
184 void* iter = NULL; 180 void* iter = NULL;
185 std::string name; 181 std::string name;
186 while (headers->EnumerateHeaderLines(&iter, &name, &value)) { 182 while (headers->EnumerateHeaderLines(&iter, &name, &value)) {
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 580
585 void WebURLLoaderImpl::cancel() { 581 void WebURLLoaderImpl::cancel() {
586 context_->Cancel(); 582 context_->Cancel();
587 } 583 }
588 584
589 void WebURLLoaderImpl::setDefersLoading(bool value) { 585 void WebURLLoaderImpl::setDefersLoading(bool value) {
590 context_->SetDefersLoading(value); 586 context_->SetDefersLoading(value);
591 } 587 }
592 588
593 } // namespace webkit_glue 589 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « net/base/net_util_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698