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

Unified Diff: chrome/browser/views/tab_contents/tab_contents_view_win.cc

Issue 271056: Do some cleanup of file path name handling. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/views/new_profile_dialog.cc ('k') | net/base/net_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/tab_contents/tab_contents_view_win.cc
===================================================================
--- chrome/browser/views/tab_contents/tab_contents_view_win.cc (revision 29772)
+++ chrome/browser/views/tab_contents/tab_contents_view_win.cc (working copy)
@@ -138,10 +138,12 @@
file_name = file_name.BaseName().RemoveExtension();
if (file_name.value().empty()) {
// Retrieve the name from the URL.
- std::wstring fn = net::GetSuggestedFilename(drop_data.url, "", "", L"");
- if ((fn.size() + drop_data.file_extension.size() + 1) > MAX_PATH)
- fn = fn.substr(0, MAX_PATH - drop_data.file_extension.size() - 2);
- file_name = FilePath::FromWStringHack(fn);
+ file_name = net::GetSuggestedFilename(drop_data.url, "", "", "");
+ if (file_name.value().size() + drop_data.file_extension.size() + 1 >
+ MAX_PATH) {
+ file_name = FilePath(file_name.value().substr(
+ 0, MAX_PATH - drop_data.file_extension.size() - 2));
+ }
}
file_name = file_name.ReplaceExtension(drop_data.file_extension);
data.SetFileContents(file_name.value(), drop_data.file_contents);
« no previous file with comments | « chrome/browser/views/new_profile_dialog.cc ('k') | net/base/net_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698