summaryrefslogtreecommitdiffstats
path: root/net/base/net_util.cc
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-19 23:58:23 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-19 23:58:23 +0000
commitf311bd71f1defeb33ec4903593e23061a913f992 (patch)
treed3dd7f2422d41b15946002bf582b07f919475046 /net/base/net_util.cc
parent5dce90240ecb2259290cd3aa12294b832b09eee9 (diff)
downloadchromium_src-f311bd71f1defeb33ec4903593e23061a913f992.zip
chromium_src-f311bd71f1defeb33ec4903593e23061a913f992.tar.gz
chromium_src-f311bd71f1defeb33ec4903593e23061a913f992.tar.bz2
revert 5730
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5731 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/net_util.cc')
-rw-r--r--net/base/net_util.cc25
1 files changed, 8 insertions, 17 deletions
diff --git a/net/base/net_util.cc b/net/base/net_util.cc
index 3946c6b..05419fb 100644
--- a/net/base/net_util.cc
+++ b/net/base/net_util.cc
@@ -23,7 +23,6 @@
#include "net/base/net_util.h"
#include "base/basictypes.h"
-#include "base/file_path.h"
#include "base/file_util.h"
#include "base/logging.h"
#include "base/path_service.h"
@@ -799,22 +798,12 @@ std::string CanonicalizeHost(const std::wstring& host, bool* is_ip_address) {
return CanonicalizeHost(converted_host, is_ip_address);
}
+#ifdef OS_WIN
std::string GetDirectoryListingHeader(const std::string& title) {
-#if defined(OS_WIN)
std::string result = NetModule::GetResource(IDR_DIR_HEADER_HTML);
if (result.empty()) {
NOTREACHED() << "expected resource not found";
}
-#elif defined(OS_POSIX)
- // TODO(estade): Temporary hack. Remove these platform #ifdefs when we
- // have implemented resources for non-Windows platforms.
- LOG(INFO) << "FIXME: hacked resource loading";
- FilePath path;
- PathService::Get(base::DIR_EXE, &path);
- path = path.Append("../../net/base/dir_header.html");
- std::string result;
- file_util::ReadFileToString(path.ToWStringHack(), &result);
-#endif
result.append("<script>start(");
string_escape::JavascriptDoubleQuote(title, true, &result);
@@ -824,16 +813,16 @@ std::string GetDirectoryListingHeader(const std::string& title) {
}
std::string GetDirectoryListingEntry(const std::string& name,
- bool is_dir,
+ DWORD attrib,
int64 size,
- const Time& modified) {
+ const FILETIME* modified) {
std::string result;
result.append("<script>addRow(");
string_escape::JavascriptDoubleQuote(name, true, &result);
result.append(",");
string_escape::JavascriptDoubleQuote(
EscapePath(name), true, &result);
- if (is_dir) {
+ if (attrib & FILE_ATTRIBUTE_DIRECTORY) {
result.append(",1,");
} else {
result.append(",0,");
@@ -846,8 +835,9 @@ std::string GetDirectoryListingEntry(const std::string& name,
std::wstring modified_str;
// |modified| can be NULL in FTP listings.
- if (!modified.is_null()) {
- modified_str = base::TimeFormatShortDateAndTime(modified);
+ if (modified) {
+ Time time(Time::FromFileTime(*modified));
+ modified_str = base::TimeFormatShortDateAndTime(time);
}
string_escape::JavascriptDoubleQuote(modified_str, true, &result);
@@ -855,6 +845,7 @@ std::string GetDirectoryListingEntry(const std::string& name,
return result;
}
+#endif
std::wstring StripWWW(const std::wstring& text) {
const std::wstring www(L"www.");