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

Unified Diff: chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.cc

Issue 145303002: Convert Media Galleries to use base::File (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 11 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
Index: chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.cc
diff --git a/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.cc b/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.cc
index fc81b2854ccf2dc9be95a7a89ffba71e736b85f3..24880a59b53655b4a8160b8b14064027829492ec 100644
--- a/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.cc
+++ b/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.cc
@@ -148,12 +148,12 @@ bool OpenDeviceOnBlockingPoolThread(
// Gets the |file_path| details from the MTP device specified by the
// |device_info.registered_device_path|. On success, |error| is set to
-// base::PLATFORM_FILE_OK and fills in |file_info|. On failure, |error| is set
+// base::File::FILE_OK and fills in |file_info|. On failure, |error| is set
// to corresponding platform file error and |file_info| is not set.
-base::PlatformFileError GetFileInfoOnBlockingPoolThread(
+base::File::Error GetFileInfoOnBlockingPoolThread(
const MTPDeviceDelegateImplWin::StorageDeviceInfo& device_info,
const base::FilePath& file_path,
- base::PlatformFileInfo* file_info) {
+ base::File::Info* file_info) {
base::ThreadRestrictions::AssertIOAllowed();
DCHECK(!device_info.registered_device_path.empty());
DCHECK(!file_path.empty());
@@ -162,36 +162,35 @@ base::PlatformFileError GetFileInfoOnBlockingPoolThread(
PortableDeviceMapService::GetInstance()->GetPortableDevice(
device_info.registered_device_path);
if (!device)
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
base::string16 object_id =
GetFileObjectIdFromPathOnBlockingPoolThread(device_info, file_path);
if (object_id.empty())
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
return media_transfer_protocol::GetFileEntryInfo(device, object_id,
file_info);
}
// Reads the |root| directory file entries on a blocking pool thread. On
-// success, |error| is set to base::PLATFORM_FILE_OK and |entries| contains the
+// success, |error| is set to base::File::FILE_OK and |entries| contains the
// directory file entries. On failure, |error| is set to platform file error
// and |entries| is not set.
-base::PlatformFileError ReadDirectoryOnBlockingPoolThread(
+base::File::Error ReadDirectoryOnBlockingPoolThread(
const MTPDeviceDelegateImplWin::StorageDeviceInfo& device_info,
const base::FilePath& root,
fileapi::AsyncFileUtil::EntryList* entries) {
base::ThreadRestrictions::AssertIOAllowed();
DCHECK(!root.empty());
DCHECK(entries);
- base::PlatformFileInfo file_info;
- base::PlatformFileError error = GetFileInfoOnBlockingPoolThread(device_info,
- root,
- &file_info);
- if (error != base::PLATFORM_FILE_OK)
+ base::File::Info file_info;
+ base::File::Error error = GetFileInfoOnBlockingPoolThread(device_info, root,
+ &file_info);
+ if (error != base::File::FILE_OK)
return error;
if (!file_info.is_directory)
- return base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY;
+ return base::File::FILE_ERROR_NOT_A_DIRECTORY;
base::FilePath current;
scoped_ptr<MTPDeviceObjectEnumerator> file_enum =
@@ -212,10 +211,10 @@ base::PlatformFileError ReadDirectoryOnBlockingPoolThread(
// Gets the device file stream object on a blocking pool thread.
// |device_info| contains the device storage partition details.
-// On success, returns base::PLATFORM_FILE_OK and file stream details are set in
+// On success, returns base::File::FILE_OK and file stream details are set in
// |file_details|. On failure, returns a platform file error and file stream
// details are not set in |file_details|.
-base::PlatformFileError GetFileStreamOnBlockingPoolThread(
+base::File::Error GetFileStreamOnBlockingPoolThread(
const MTPDeviceDelegateImplWin::StorageDeviceInfo& device_info,
SnapshotFileDetails* file_details) {
base::ThreadRestrictions::AssertIOAllowed();
@@ -226,21 +225,21 @@ base::PlatformFileError GetFileStreamOnBlockingPoolThread(
PortableDeviceMapService::GetInstance()->GetPortableDevice(
device_info.registered_device_path);
if (!device)
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
base::string16 file_object_id =
GetFileObjectIdFromPathOnBlockingPoolThread(
device_info, file_details->request_info().device_file_path);
if (file_object_id.empty())
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
- base::PlatformFileInfo file_info;
- base::PlatformFileError error =
+ base::File::Info file_info;
+ base::File::Error error =
GetFileInfoOnBlockingPoolThread(
device_info,
file_details->request_info().device_file_path,
&file_info);
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return error;
DWORD optimal_transfer_size = 0;
@@ -252,7 +251,7 @@ base::PlatformFileError GetFileStreamOnBlockingPoolThread(
file_stream.Receive(),
&optimal_transfer_size);
if (hr != S_OK)
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
}
// LocalFileStreamReader is used to read the contents of the snapshot file.
@@ -348,8 +347,8 @@ MTPDeviceDelegateImplWin::StorageDeviceInfo::StorageDeviceInfo(
MTPDeviceDelegateImplWin::PendingTaskInfo::PendingTaskInfo(
const tracked_objects::Location& location,
- const base::Callback<base::PlatformFileError(void)>& task,
- const base::Callback<void(base::PlatformFileError)>& reply)
+ const base::Callback<base::File::Error(void)>& task,
+ const base::Callback<void(base::File::Error)>& reply)
: location(location),
task(task),
reply(reply) {
@@ -382,7 +381,7 @@ void MTPDeviceDelegateImplWin::GetFileInfo(
const ErrorCallback& error_callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
DCHECK(!file_path.empty());
- base::PlatformFileInfo* file_info = new base::PlatformFileInfo;
+ base::File::Info* file_info = new base::File::Info;
EnsureInitAndRunTask(
PendingTaskInfo(FROM_HERE,
base::Bind(&GetFileInfoOnBlockingPoolThread,
@@ -531,11 +530,11 @@ void MTPDeviceDelegateImplWin::OnInitCompleted(bool succeeded) {
void MTPDeviceDelegateImplWin::OnGetFileInfo(
const GetFileInfoSuccessCallback& success_callback,
const ErrorCallback& error_callback,
- base::PlatformFileInfo* file_info,
- base::PlatformFileError error) {
+ base::File::Info* file_info,
+ base::File::Error error) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
DCHECK(file_info);
- if (error == base::PLATFORM_FILE_OK)
+ if (error == base::File::FILE_OK)
success_callback.Run(*file_info);
else
error_callback.Run(error);
@@ -547,10 +546,10 @@ void MTPDeviceDelegateImplWin::OnDidReadDirectory(
const ReadDirectorySuccessCallback& success_callback,
const ErrorCallback& error_callback,
fileapi::AsyncFileUtil::EntryList* file_list,
- base::PlatformFileError error) {
+ base::File::Error error) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
DCHECK(file_list);
- if (error == base::PLATFORM_FILE_OK)
+ if (error == base::File::FILE_OK)
success_callback.Run(*file_list, false /*no more entries*/);
else
error_callback.Run(error);
@@ -560,13 +559,13 @@ void MTPDeviceDelegateImplWin::OnDidReadDirectory(
void MTPDeviceDelegateImplWin::OnGetFileStream(
scoped_ptr<SnapshotFileDetails> file_details,
- base::PlatformFileError error) {
+ base::File::Error error) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
DCHECK(file_details);
DCHECK(!file_details->request_info().device_file_path.empty());
DCHECK(!file_details->request_info().snapshot_file_path.empty());
DCHECK(!current_snapshot_details_.get());
- if (error != base::PLATFORM_FILE_OK) {
+ if (error != base::File::FILE_OK) {
file_details->request_info().error_callback.Run(error);
task_in_progress_ = false;
ProcessNextPendingRequest();
@@ -615,7 +614,7 @@ void MTPDeviceDelegateImplWin::OnWroteDataChunkIntoSnapshotFile(
current_snapshot_details_->request_info().snapshot_file_path);
} else {
current_snapshot_details_->request_info().error_callback.Run(
- base::PLATFORM_FILE_ERROR_FAILED);
+ base::File::FILE_ERROR_FAILED);
}
task_in_progress_ = false;
current_snapshot_details_.reset();

Powered by Google App Engine
This is Rietveld 408576698