Chromium Code Reviews| Index: net/base/net_util.cc |
| diff --git a/net/base/net_util.cc b/net/base/net_util.cc |
| index 9e1ebe55f5049b1432bf17ae54b5b52333440936..e384d0560f790d45a01f9e68ba405578da4be988 100644 |
| --- a/net/base/net_util.cc |
| +++ b/net/base/net_util.cc |
| @@ -17,10 +17,12 @@ |
| #pragma comment(lib, "iphlpapi.lib") |
| #elif defined(OS_POSIX) |
| #include <fcntl.h> |
| -#if !defined(OS_ANDROID) |
| +#if !defined(OS_ANDROID) && !defined(OS_NACL) |
| #include <ifaddrs.h> |
| #endif |
| +#if !defined(OS_NACL) |
| #include <net/if.h> |
| +#endif |
| #include <netdb.h> |
| #include <netinet/in.h> |
|
Ryan Sleevi
2014/03/06 22:02:17
Seems like this should be reworded as
#elif defin
Sergey Ulanov
2014/03/21 19:34:41
Done.
|
| #endif |
| @@ -52,7 +54,9 @@ |
| #include "base/sys_byteorder.h" |
| #include "base/time/time.h" |
| #include "base/values.h" |
| +#if !defined(OS_NACL) |
| #include "grit/net_resources.h" |
| +#endif |
|
Ryan Sleevi
2014/03/06 22:02:17
Likewise, it seems like this, lines 64-66, and 72-
Sergey Ulanov
2014/03/21 19:34:41
Done.
|
| #include "url/gurl.h" |
| #include "url/url_canon.h" |
| #include "url/url_canon_ip.h" |
| @@ -998,12 +1002,14 @@ GURL FilePathToFileURL(const base::FilePath& path) { |
| // "file://///server/path" for UNC. The URL canonicalizer will fix up the |
| // latter case to be the canonical UNC form: "file://server/path" |
| base::FilePath::StringType url_string(kFileURLPrefix); |
| +#if !defined(OS_NACL) |
| if (!path.IsAbsolute()) { |
| base::FilePath current_dir; |
| PathService::Get(base::DIR_CURRENT, ¤t_dir); |
| url_string.append(current_dir.value()); |
| url_string.push_back(base::FilePath::kSeparators[0]); |
| } |
| +#endif |
| url_string.append(path.value()); |
| // Now do replacement of some characters. Since we assume the input is a |
| @@ -1092,6 +1098,7 @@ std::string CanonicalizeHost(const std::string& host, |
| return canon_host; |
| } |
| +#if !defined(OS_NACL) |
| std::string GetDirectoryListingHeader(const base::string16& title) { |
| static const base::StringPiece header( |
| NetModule::GetResource(IDR_DIR_HEADER_HTML)); |
| @@ -1109,6 +1116,7 @@ std::string GetDirectoryListingHeader(const base::string16& title) { |
| return result; |
| } |
| +#endif |
| inline bool IsHostCharAlphanumeric(char c) { |
| // We can just check lowercase because uppercase characters have already been |
| @@ -1151,6 +1159,7 @@ bool IsCanonicalizedHostCompliant(const std::string& host, |
| (!desired_tld.empty() && IsHostCharAlphanumeric(desired_tld[0])); |
| } |
| +#if !defined(OS_NACL) |
| std::string GetDirectoryListingEntry(const base::string16& name, |
| const std::string& raw_bytes, |
| bool is_dir, |
| @@ -1190,6 +1199,7 @@ std::string GetDirectoryListingEntry(const base::string16& name, |
| return result; |
| } |
| +#endif // !defined(OS_NACL) |
| base::string16 StripWWW(const base::string16& text) { |
| const base::string16 www(base::ASCIIToUTF16("www.")); |
| @@ -1254,6 +1264,7 @@ void GenerateSafeFileName(const std::string& mime_type, |
| #endif |
| } |
| +#if !defined(OS_NACL) |
| base::string16 GetSuggestedFilename(const GURL& url, |
| const std::string& content_disposition, |
| const std::string& referrer_charset, |
| @@ -1362,6 +1373,8 @@ base::FilePath GenerateFileName(const GURL& url, |
| return generated_name; |
| } |
| +#endif // !defined(OS_NACL) |
| + |
| bool IsPortAllowedByDefault(int port) { |
| int array_size = arraysize(kRestrictedPorts); |
| for (int i = 0; i < array_size; i++) { |
| @@ -1670,6 +1683,10 @@ std::string IPAddressToPackedString(const IPAddressNumber& addr) { |
| } |
| std::string GetHostName() { |
| +#if defined(OS_NACL) |
| + NOTIMPLEMENTED(); |
| + return std::string(); |
| +#else // defined(OS_NACL) |
| #if defined(OS_WIN) |
| EnsureWinsockInit(); |
| #endif |
| @@ -1682,6 +1699,7 @@ std::string GetHostName() { |
| buffer[0] = '\0'; |
| } |
| return std::string(buffer); |
| +#endif // !defined(OS_NACL) |
| } |
| void GetIdentityFromURL(const GURL& url, |
| @@ -1947,6 +1965,9 @@ ScopedPortException::~ScopedPortException() { |
| bool HaveOnlyLoopbackAddresses() { |
| #if defined(OS_ANDROID) |
| return android::HaveOnlyLoopbackAddresses(); |
| +#elif defined(OS_NACL) |
| + NOTIMPLEMENTED(); |
| + return false; |
| #elif defined(OS_POSIX) |
| struct ifaddrs* interface_addr = NULL; |
| int rv = getifaddrs(&interface_addr); |