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

Side by Side Diff: net/base/net_util.cc

Issue 11506: Make the net resource interface use StringPiece instead of std::string. This... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/base/net_module.cc ('k') | net/base/registry_controlled_domain.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « net/base/net_module.cc ('k') | net/base/registry_controlled_domain.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698