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

Unified Diff: net/url_request/url_request_file_dir_job.cc

Issue 151065: Fix the local file listing and FTP file listing. For the former, use the OS f... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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
Index: net/url_request/url_request_file_dir_job.cc
===================================================================
--- net/url_request/url_request_file_dir_job.cc (revision 20014)
+++ net/url_request/url_request_file_dir_job.cc (working copy)
@@ -7,6 +7,7 @@
#include "base/file_util.h"
#include "base/message_loop.h"
#include "base/string_util.h"
+#include "base/sys_string_conversions.h"
#include "base/time.h"
#include "googleurl/src/gurl.h"
#include "net/base/io_buffer.h"
@@ -104,9 +105,15 @@
// can catch errors from DirectoryLister and show an error page.
if (!wrote_header_) {
#if defined(OS_WIN)
- const std::string& title = WideToUTF8(dir_path_.value());
+ const string16& title = dir_path_.value();
#elif defined(OS_POSIX)
- const std::string& title = dir_path_.value();
+ // TODO(jungshik): Add SysNativeMBToUTF16 to sys_string_conversions.
+ // On Mac, need to add NFKC->NFC conversion either here or in file_path.
+ // On Linux, the file system encoding is not defined, but we assume that
+ // SysNativeMBToWide takes care of it at least for now. We can try something
+ // more sophisticated if necessary later.
+ const string16& title = WideToUTF16(
+ base::SysNativeMBToWide(dir_path_.value()));
#endif
data_.append(net::GetDirectoryListingHeader(title));
wrote_header_ = true;
@@ -119,14 +126,16 @@
data.nFileSizeLow;
data_.append(net::GetDirectoryListingEntry(
- WideToUTF8(data.cFileName),
+ data.cFileName, std::string(),
(data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? true : false,
size,
base::Time::FromFileTime(local_time)));
#elif defined(OS_POSIX)
+ // TOOD(jungshik): The same issue as for the directory name.
data_.append(net::GetDirectoryListingEntry(
- data.filename.c_str(),
+ WideToUTF16(base::SysNativeMBToWide(data.filename)),
+ data.filename,
S_ISDIR(data.stat.st_mode),
data.stat.st_size,
base::Time::FromTimeT(data.stat.st_mtime)));

Powered by Google App Engine
This is Rietveld 408576698