Revert 235752 "Fix chrome upload with content uri"
> Fix chrome upload with content uri
>
> For android, the upload file dialog returns files with content uri scheme(content://).
> This CL makes it possible for upload to work with this new file type.
> It fixes both the form and fileapi based uploads.
>
> The CL follows the same code path used by regular file upload and the content url is encompassed by a FilePath object.
>
> R=jar@chromium.org, joth@chromium.org, kinuko@chromium.org, mmenke@chromium.org, tsepez@chromium.org
> TBR=yfriedman
> BUG=278640
>
> Review URL: https://codereview.chromium.org/46303005
TBR=qinmin@chromium.org
Review URL: https://codereview.chromium.org/65043023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@235760 0039d316-1c4b-4281-b951-d872f2087c98
CrOS-Libchrome-Original-Commit: 912bf8a680aa1c0251e55a926168602f0e8b6b9d
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc
index 4546e31..a2dd19b 100644
--- a/base/file_util_posix.cc
+++ b/base/file_util_posix.cc
@@ -48,7 +48,6 @@
#include "base/time/time.h"
#if defined(OS_ANDROID)
-#include "base/android/content_uri_utils.h"
#include "base/os_compat_android.h"
#endif
@@ -80,12 +79,6 @@
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
// Helper for NormalizeFilePath(), defined below.
@@ -315,11 +308,6 @@
bool PathExists(const FilePath& path) {
ThreadRestrictions::AssertIOAllowed();
-#if defined(OS_ANDROID)
- if (path.IsContentUri()) {
- return ContentUriExists(path);
- }
-#endif
return access(path.value().c_str(), F_OK) == 0;
}
@@ -581,21 +569,8 @@
bool GetFileInfo(const FilePath& file_path, base::PlatformFileInfo* results) {
stat_wrapper_t file_info;
-#if defined(OS_ANDROID)
- if (file_path.IsContentUri()) {
- int fd = OpenContentUriForRead(file_path);
- if (fd < 0)
- return false;
- ScopedFD scoped_fd(&fd);
- if (base::CallFstat(fd, &file_info) != 0)
- return false;
- } else {
-#endif // defined(OS_ANDROID)
- if (CallStat(file_path.value().c_str(), &file_info) != 0)
- return false;
-#if defined(OS_ANDROID)
- }
-#endif // defined(OS_ANDROID)
+ if (CallStat(file_path.value().c_str(), &file_info) != 0)
+ return false;
results->is_directory = S_ISDIR(file_info.st_mode);
results->size = file_info.st_size;
#if defined(OS_MACOSX)