net: Update FileStream to use base::File instead of PlatformFile.

As collateral damage, OpenContentUriForRead is now returning File instead of
a plain file descriptor.

BUG=322664
TEST=net_unittests
[email protected]

Review URL: https://codereview.chromium.org/189393002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@258472 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc
index 2570172..03afea7 100644
--- a/base/file_util_posix.cc
+++ b/base/file_util_posix.cc
@@ -71,7 +71,7 @@
   ThreadRestrictions::AssertIOAllowed();
   return lstat(path, sb);
 }
-#else
+#else  // defined(OS_BSD) || defined(OS_MACOSX)
 typedef struct stat64 stat_wrapper_t;
 static int CallStat(const char *path, stat_wrapper_t *sb) {
   ThreadRestrictions::AssertIOAllowed();
@@ -81,13 +81,7 @@
   ThreadRestrictions::AssertIOAllowed();
   return lstat64(path, sb);
 }
-#if defined(OS_ANDROID)
-static int CallFstat(int fd, stat_wrapper_t *sb) {
-  ThreadRestrictions::AssertIOAllowed();
-  return fstat64(fd, sb);
-}
-#endif
-#endif
+#endif // !(defined(OS_BSD) || defined(OS_MACOSX))
 
 // Helper for NormalizeFilePath(), defined below.
 bool RealPath(const FilePath& path, FilePath* real_path) {
@@ -634,11 +628,10 @@
   stat_wrapper_t file_info;
 #if defined(OS_ANDROID)
   if (file_path.IsContentUri()) {
-    ScopedFD fd(OpenContentUriForRead(file_path));
-    if (!fd.is_valid())
+    File file = OpenContentUriForRead(file_path);
+    if (!file.IsValid())
       return false;
-    if (CallFstat(fd.get(), &file_info) != 0)
-      return false;
+    return file.GetInfo(results);
   } else {
 #endif  // defined(OS_ANDROID)
     if (CallStat(file_path.value().c_str(), &file_info) != 0)