summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorrvargas@chromium.org <rvargas@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-09 19:26:26 +0000
committerrvargas@chromium.org <rvargas@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-09 19:26:26 +0000
commite9307cd7e9de8a0581c765cf525501c464c90600 (patch)
tree8c9a29dc6216208f6ae7fff0eb3516c02ba72822 /chrome
parentc91fdf490cb258423d203459371b0328c10ef081 (diff)
downloadchromium_src-e9307cd7e9de8a0581c765cf525501c464c90600.zip
chromium_src-e9307cd7e9de8a0581c765cf525501c464c90600.tar.gz
chromium_src-e9307cd7e9de8a0581c765cf525501c464c90600.tar.bz2
Remove CreatePlatformFile from chromeos/drive
BUG=322664 Review URL: https://codereview.chromium.org/227813002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@262769 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/chromeos/drive/fileapi/fileapi_worker.cc36
1 files changed, 18 insertions, 18 deletions
diff --git a/chrome/browser/chromeos/drive/fileapi/fileapi_worker.cc b/chrome/browser/chromeos/drive/fileapi/fileapi_worker.cc
index 2ae6908..0028c95 100644
--- a/chrome/browser/chromeos/drive/fileapi/fileapi_worker.cc
+++ b/chrome/browser/chromeos/drive/fileapi/fileapi_worker.cc
@@ -149,9 +149,14 @@ void RunCreateWritableSnapshotFileCallback(
// Runs |callback| with |error| and |platform_file|.
void RunOpenFileCallback(const OpenFileCallback& callback,
const base::Closure& close_callback,
- base::File::Error* error,
- base::PlatformFile platform_file) {
- callback.Run(*error, platform_file, close_callback);
+ base::File file) {
+ base::File::Error error = file.IsValid() ? base::File::FILE_OK :
+ file.error_details();
+ callback.Run(error, file.TakePlatformFile(), close_callback);
+}
+
+base::File OpenFile(const base::FilePath& path, int flags) {
+ return base::File(path, flags);
}
// Part of OpenFile(). Called after FileSystem::OpenFile().
@@ -174,27 +179,22 @@ void OpenFileAfterFileSystemOpenFile(int file_flags,
// unexpected file creation, CREATE, OPEN_ALWAYS and CREATE_ALWAYS are
// translated into OPEN or OPEN_TRUNCATED, here. Keep OPEN and OPEN_TRUNCATED
// as is.
- if (file_flags & (base::PLATFORM_FILE_CREATE |
- base::PLATFORM_FILE_OPEN_ALWAYS)) {
- file_flags &= ~(base::PLATFORM_FILE_CREATE |
- base::PLATFORM_FILE_OPEN_ALWAYS);
- file_flags |= base::PLATFORM_FILE_OPEN;
- } else if (file_flags & base::PLATFORM_FILE_CREATE_ALWAYS) {
- file_flags &= ~base::PLATFORM_FILE_CREATE_ALWAYS;
- file_flags |= base::PLATFORM_FILE_OPEN_TRUNCATED;
+ if (file_flags & (base::File::FLAG_CREATE |
+ base::File::FLAG_OPEN_ALWAYS)) {
+ file_flags &= ~(base::File::FLAG_CREATE |
+ base::File::FLAG_OPEN_ALWAYS);
+ file_flags |= base::File::FLAG_OPEN;
+ } else if (file_flags & base::File::FLAG_CREATE_ALWAYS) {
+ file_flags &= ~base::File::FLAG_CREATE_ALWAYS;
+ file_flags |= base::File::FLAG_OPEN_TRUNCATED;
}
// Cache file prepared for modification is available. Open it locally.
- // TODO(rvargas): Convert this to base::File.
- base::File::Error* result =
- new base::File::Error(base::File::FILE_ERROR_FAILED);
bool posted = base::PostTaskAndReplyWithResult(
BrowserThread::GetBlockingPool(), FROM_HERE,
- base::Bind(&base::CreatePlatformFile,
- local_path, file_flags, static_cast<bool*>(NULL),
- reinterpret_cast<base::PlatformFileError*>(result)),
+ base::Bind(&OpenFile, local_path, file_flags),
base::Bind(&RunOpenFileCallback,
- callback, close_callback, base::Owned(result)));
+ callback, close_callback));
DCHECK(posted);
}