From 721c3f17a7fb36edaa17f607a11db9c82ba720ca Mon Sep 17 00:00:00 2001 From: "estade@chromium.org" Date: Wed, 19 Nov 2008 23:04:29 +0000 Subject: Port directory lister so test shell can view file directories. Review URL: http://codereview.chromium.org/11437 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5725 0039d316-1c4b-4281-b951-d872f2087c98 --- net/base/net_util.cc | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'net/base/net_util.cc') diff --git a/net/base/net_util.cc b/net/base/net_util.cc index 05419fb..3946c6b 100644 --- a/net/base/net_util.cc +++ b/net/base/net_util.cc @@ -23,6 +23,7 @@ #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" @@ -798,12 +799,22 @@ 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("