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

Side by Side Diff: chrome/browser/media_galleries/fileapi/device_media_async_file_util.cc

Issue 278113002: Remove PlatformFile from fileapi::AsyncFileUtil (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/media_galleries/fileapi/device_media_async_file_util.h" 5 #include "chrome/browser/media_galleries/fileapi/device_media_async_file_util.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/task_runner_util.h" 10 #include "base/task_runner_util.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 void DeviceMediaAsyncFileUtil::CreateOrOpen( 82 void DeviceMediaAsyncFileUtil::CreateOrOpen(
83 scoped_ptr<FileSystemOperationContext> context, 83 scoped_ptr<FileSystemOperationContext> context,
84 const FileSystemURL& url, 84 const FileSystemURL& url,
85 int file_flags, 85 int file_flags,
86 const CreateOrOpenCallback& callback) { 86 const CreateOrOpenCallback& callback) {
87 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 87 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
88 // Returns an error if any unsupported flag is found. 88 // Returns an error if any unsupported flag is found.
89 if (file_flags & ~(base::File::FLAG_OPEN | 89 if (file_flags & ~(base::File::FLAG_OPEN |
90 base::File::FLAG_READ | 90 base::File::FLAG_READ |
91 base::File::FLAG_WRITE_ATTRIBUTES)) { 91 base::File::FLAG_WRITE_ATTRIBUTES)) {
92 base::PlatformFile invalid_file(base::kInvalidPlatformFileValue); 92 callback.Run(base::File(base::File::FILE_ERROR_SECURITY), base::Closure());
93 callback.Run(base::File::FILE_ERROR_SECURITY,
94 base::PassPlatformFile(&invalid_file),
95 base::Closure());
96 return; 93 return;
97 } 94 }
98 CreateSnapshotFile( 95 CreateSnapshotFile(
99 context.Pass(), 96 context.Pass(),
100 url, 97 url,
101 base::Bind(&NativeMediaFileUtil::CreatedSnapshotFileForCreateOrOpen, 98 base::Bind(&NativeMediaFileUtil::CreatedSnapshotFileForCreateOrOpen,
102 make_scoped_refptr(context->task_runner()), 99 make_scoped_refptr(context->task_runner()),
103 file_flags, 100 file_flags,
104 callback)); 101 callback));
105 } 102 }
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 url.path(), // device file path 381 url.path(), // device file path
385 snapshot_file_path, 382 snapshot_file_path,
386 base::Bind(&DeviceMediaAsyncFileUtil::OnDidCreateSnapshotFile, 383 base::Bind(&DeviceMediaAsyncFileUtil::OnDidCreateSnapshotFile,
387 weak_ptr_factory_.GetWeakPtr(), 384 weak_ptr_factory_.GetWeakPtr(),
388 callback, 385 callback,
389 make_scoped_refptr(context->task_runner())), 386 make_scoped_refptr(context->task_runner())),
390 base::Bind(&DeviceMediaAsyncFileUtil::OnCreateSnapshotFileError, 387 base::Bind(&DeviceMediaAsyncFileUtil::OnCreateSnapshotFileError,
391 weak_ptr_factory_.GetWeakPtr(), 388 weak_ptr_factory_.GetWeakPtr(),
392 callback)); 389 callback));
393 } 390 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698