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

Unified Diff: net/base/net_util.cc

Issue 188873004: Compile src/net for PNaCl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/iovec.h ('k') | net/base/net_util_posix.cc » ('j') | net/net.gypi » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/net_util.cc
diff --git a/net/base/net_util.cc b/net/base/net_util.cc
index 0174c653f83065c3ef48fd90a31254d0d4d4b03c..43203a701ff41228ff6e05a9696807d55a665537 100644
--- a/net/base/net_util.cc
+++ b/net/base/net_util.cc
@@ -17,13 +17,15 @@
#pragma comment(lib, "iphlpapi.lib")
#elif defined(OS_POSIX)
#include <fcntl.h>
-#if !defined(OS_ANDROID)
-#include <ifaddrs.h>
-#endif
-#include <net/if.h>
#include <netdb.h>
#include <netinet/in.h>
-#endif
+#if !defined(OS_NACL)
+#include <net/if.h>
+#if !defined(OS_ANDROID)
+#include <ifaddrs.h>
+#endif // !defined(OS_NACL)
+#endif // !defined(OS_ANDROID)
+#endif // defined(OS_POSIX)
#include "base/basictypes.h"
#include "base/file_util.h"
@@ -52,22 +54,15 @@
#include "base/sys_byteorder.h"
#include "base/time/time.h"
#include "base/values.h"
-#include "grit/net_resources.h"
#include "url/gurl.h"
#include "url/url_canon.h"
#include "url/url_canon_ip.h"
#include "url/url_parse.h"
-#if defined(OS_ANDROID)
-#include "net/android/network_library.h"
-#endif
#include "net/base/dns_util.h"
#include "net/base/escape.h"
#include "net/base/mime_util.h"
#include "net/base/net_module.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
-#if defined(OS_WIN)
-#include "net/base/winsock_init.h"
-#endif
#include "net/http/http_content_disposition.h"
#include "third_party/icu/source/common/unicode/uidna.h"
#include "third_party/icu/source/common/unicode/uniset.h"
@@ -77,6 +72,16 @@
#include "third_party/icu/source/i18n/unicode/regex.h"
#include "third_party/icu/source/i18n/unicode/ulocdata.h"
+#if defined(OS_ANDROID)
+#include "net/android/network_library.h"
+#endif
+#if defined(OS_WIN)
+#include "net/base/winsock_init.h"
+#endif
+#if !defined(OS_NACL)
+#include "grit/net_resources.h"
+#endif
+
using base::Time;
namespace net {
@@ -998,12 +1003,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)
Ryan Sleevi 2014/03/27 01:04:41 What part of this is broken under NACL?
Sergey Ulanov 2014/04/01 00:30:14 base_nacl doesn't compile PathService.
if (!path.IsAbsolute()) {
base::FilePath current_dir;
PathService::Get(base::DIR_CURRENT, &current_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 +1099,7 @@ std::string CanonicalizeHost(const std::string& host,
return canon_host;
}
+#if !defined(OS_NACL)
Ryan Sleevi 2014/03/27 01:04:41 Does this really need to be excluded - eg: if you
Sergey Ulanov 2014/04/01 00:30:14 Done.
std::string GetDirectoryListingHeader(const base::string16& title) {
static const base::StringPiece header(
NetModule::GetResource(IDR_DIR_HEADER_HTML));
@@ -1109,6 +1117,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 +1160,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 +1200,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 +1265,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 +1374,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 +1684,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 +1700,7 @@ std::string GetHostName() {
buffer[0] = '\0';
}
return std::string(buffer);
+#endif // !defined(OS_NACL)
}
void GetIdentityFromURL(const GURL& url,
@@ -1947,6 +1966,9 @@ ScopedPortException::~ScopedPortException() {
bool HaveOnlyLoopbackAddresses() {
#if defined(OS_ANDROID)
return android::HaveOnlyLoopbackAddresses();
+#elif defined(OS_NACL)
+ NOTIMPLEMENTED();
Ryan Sleevi 2014/03/27 01:04:41 Here, you intentionally NOTIMPLEMENTED(), but in G
Sergey Ulanov 2014/04/01 00:30:14 Added NOTIMPLEMENTED in GetNetworkList() too.
+ return false;
#elif defined(OS_POSIX)
struct ifaddrs* interface_addr = NULL;
int rv = getifaddrs(&interface_addr);
« no previous file with comments | « net/base/iovec.h ('k') | net/base/net_util_posix.cc » ('j') | net/net.gypi » ('J')

Powered by Google App Engine
This is Rietveld 408576698