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 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 } | 793 } |
794 | 794 |
795 std::string CanonicalizeHost(const std::wstring& host, bool* is_ip_address) { | 795 std::string CanonicalizeHost(const std::wstring& host, bool* is_ip_address) { |
796 std::string converted_host; | 796 std::string converted_host; |
797 WideToUTF8(host.c_str(), host.length(), &converted_host); | 797 WideToUTF8(host.c_str(), host.length(), &converted_host); |
798 return CanonicalizeHost(converted_host, is_ip_address); | 798 return CanonicalizeHost(converted_host, is_ip_address); |
799 } | 799 } |
800 | 800 |
801 #ifdef OS_WIN | 801 #ifdef OS_WIN |
802 std::string GetDirectoryListingHeader(const std::string& title) { | 802 std::string GetDirectoryListingHeader(const std::string& title) { |
803 std::string result = NetModule::GetResource(IDR_DIR_HEADER_HTML); | 803 static const StringPiece header(NetModule::GetResource(IDR_DIR_HEADER_HTML)); |
804 if (result.empty()) { | 804 if (header.empty()) { |
805 NOTREACHED() << "expected resource not found"; | 805 NOTREACHED() << "expected resource not found"; |
806 } | 806 } |
807 | 807 |
| 808 std::string result(header.data(), header.size()); |
808 result.append("<script>start("); | 809 result.append("<script>start("); |
809 string_escape::JavascriptDoubleQuote(title, true, &result); | 810 string_escape::JavascriptDoubleQuote(title, true, &result); |
810 result.append(");</script>\n"); | 811 result.append(");</script>\n"); |
811 | 812 |
812 return result; | 813 return result; |
813 } | 814 } |
814 | 815 |
815 std::string GetDirectoryListingEntry(const std::string& name, | 816 std::string GetDirectoryListingEntry(const std::string& name, |
816 DWORD attrib, | 817 DWORD attrib, |
817 int64 size, | 818 int64 size, |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 return ioctlsocket(fd, FIONBIO, &no_block); | 928 return ioctlsocket(fd, FIONBIO, &no_block); |
928 #elif defined(OS_POSIX) | 929 #elif defined(OS_POSIX) |
929 int flags = fcntl(fd, F_GETFL, 0); | 930 int flags = fcntl(fd, F_GETFL, 0); |
930 if (-1 == flags) | 931 if (-1 == flags) |
931 flags = 0; | 932 flags = 0; |
932 return fcntl(fd, F_SETFL, flags | O_NONBLOCK); | 933 return fcntl(fd, F_SETFL, flags | O_NONBLOCK); |
933 #endif | 934 #endif |
934 } | 935 } |
935 | 936 |
936 } // namespace net | 937 } // namespace net |
OLD | NEW |