| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include <algorithm> | 5 #include <algorithm> |
| 6 #include <unicode/ucnv.h> | 6 #include <unicode/ucnv.h> |
| 7 #include <unicode/uidna.h> | 7 #include <unicode/uidna.h> |
| 8 #include <unicode/ulocdata.h> | 8 #include <unicode/ulocdata.h> |
| 9 #include <unicode/uniset.h> | 9 #include <unicode/uniset.h> |
| 10 #include <unicode/uscript.h> | 10 #include <unicode/uscript.h> |
| (...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 canon_host_component.len); | 800 canon_host_component.len); |
| 801 } | 801 } |
| 802 | 802 |
| 803 std::string CanonicalizeHost(const std::wstring& host, bool* is_ip_address) { | 803 std::string CanonicalizeHost(const std::wstring& host, bool* is_ip_address) { |
| 804 std::string converted_host; | 804 std::string converted_host; |
| 805 WideToUTF8(host.c_str(), host.length(), &converted_host); | 805 WideToUTF8(host.c_str(), host.length(), &converted_host); |
| 806 return CanonicalizeHost(converted_host, is_ip_address); | 806 return CanonicalizeHost(converted_host, is_ip_address); |
| 807 } | 807 } |
| 808 | 808 |
| 809 std::string GetDirectoryListingHeader(const std::string& title) { | 809 std::string GetDirectoryListingHeader(const std::string& title) { |
| 810 #if defined(OS_WIN) | 810 #if defined(OS_WIN) || defined(OS_LINUX) |
| 811 static const StringPiece header(NetModule::GetResource(IDR_DIR_HEADER_HTML)); | 811 static const StringPiece header(NetModule::GetResource(IDR_DIR_HEADER_HTML)); |
| 812 if (header.empty()) { | 812 if (header.empty()) { |
| 813 NOTREACHED() << "expected resource not found"; | 813 NOTREACHED() << "expected resource not found"; |
| 814 } | 814 } |
| 815 std::string result(header.data(), header.size()); | 815 std::string result(header.data(), header.size()); |
| 816 #elif defined(OS_POSIX) | 816 #elif defined(OS_MACOSX) |
| 817 // TODO(estade): Temporary hack. Remove these platform #ifdefs when we | 817 // TODO(estade): Temporary hack. Remove these platform #ifdefs when we |
| 818 // have implemented resources for non-Windows platforms. | 818 // have implemented resources for OSX. |
| 819 LOG(INFO) << "FIXME: hacked resource loading"; | 819 LOG(INFO) << "FIXME: hacked resource loading"; |
| 820 FilePath path; | 820 FilePath path; |
| 821 PathService::Get(base::DIR_EXE, &path); | 821 PathService::Get(base::DIR_EXE, &path); |
| 822 path = path.Append("../../net/base/dir_header.html"); | 822 path = path.Append("../../net/base/dir_header.html"); |
| 823 std::string result; | 823 std::string result; |
| 824 file_util::ReadFileToString(path.ToWStringHack(), &result); | 824 file_util::ReadFileToString(path.ToWStringHack(), &result); |
| 825 #endif | 825 #endif |
| 826 | 826 |
| 827 result.append("<script>start("); | 827 result.append("<script>start("); |
| 828 string_escape::JavascriptDoubleQuote(title, true, &result); | 828 string_escape::JavascriptDoubleQuote(title, true, &result); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 952 | 952 |
| 953 // Deprecated. | 953 // Deprecated. |
| 954 bool FileURLToFilePath(const GURL& gurl, std::wstring* file_path) { | 954 bool FileURLToFilePath(const GURL& gurl, std::wstring* file_path) { |
| 955 FilePath path; | 955 FilePath path; |
| 956 bool rv = FileURLToFilePath(gurl, &path); | 956 bool rv = FileURLToFilePath(gurl, &path); |
| 957 *file_path = path.ToWStringHack(); | 957 *file_path = path.ToWStringHack(); |
| 958 return rv; | 958 return rv; |
| 959 } | 959 } |
| 960 | 960 |
| 961 } // namespace net | 961 } // namespace net |
| OLD | NEW |