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

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

Issue 27094003: Remove fileapi::FileSystemFileUtil dependency in media gallery code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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 bfa81daf7d32e5c4cdb843273f4ea6b4d86fded3..09bf2b03f6dcce398a1ee01da1dc0e6f17facd74 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
@@ -98,34 +98,32 @@ string16 GetFileObjectIdFromPathOnBlockingPoolThread(
// Returns a pointer to a new instance of AbstractFileEnumerator for the given
// |root| directory. Called on a blocking pool thread.
-scoped_ptr<fileapi::FileSystemFileUtil::AbstractFileEnumerator>
+scoped_ptr<MTPDeviceObjectEnumerator>
CreateFileEnumeratorOnBlockingPoolThread(
const MTPDeviceDelegateImplWin::StorageDeviceInfo& device_info,
const base::FilePath& root) {
base::ThreadRestrictions::AssertIOAllowed();
DCHECK(!device_info.registered_device_path.empty());
DCHECK(!root.empty());
- scoped_ptr<fileapi::FileSystemFileUtil::AbstractFileEnumerator>
- file_enumerator(new fileapi::FileSystemFileUtil::EmptyFileEnumerator());
IPortableDevice* device =
PortableDeviceMapService::GetInstance()->GetPortableDevice(
device_info.registered_device_path);
if (!device)
- return file_enumerator.Pass();
+ return scoped_ptr<MTPDeviceObjectEnumerator>();
string16 object_id = GetFileObjectIdFromPathOnBlockingPoolThread(device_info,
root);
if (object_id.empty())
- return file_enumerator.Pass();
+ return scoped_ptr<MTPDeviceObjectEnumerator>();
MTPDeviceObjectEntries entries;
if (!media_transfer_protocol::GetDirectoryEntries(device, object_id,
&entries) ||
entries.empty())
- return file_enumerator.Pass();
+ return scoped_ptr<MTPDeviceObjectEnumerator>();
- file_enumerator.reset(new MTPDeviceObjectEnumerator(entries));
- return file_enumerator.Pass();
+ return scoped_ptr<MTPDeviceObjectEnumerator>(
+ new MTPDeviceObjectEnumerator(entries));
}
// Opens the device for communication on a blocking pool thread.
@@ -195,8 +193,11 @@ base::PlatformFileError ReadDirectoryOnBlockingPoolThread(
return base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY;
base::FilePath current;
- scoped_ptr<fileapi::FileSystemFileUtil::AbstractFileEnumerator> file_enum =
+ scoped_ptr<MTPDeviceObjectEnumerator> file_enum =
CreateFileEnumeratorOnBlockingPoolThread(device_info, root);
+ if (!file_enum)
+ return error;
+
while (!(current = file_enum->Next()).empty()) {
fileapi::DirectoryEntry entry;
entry.is_directory = file_enum->IsDirectory();
@@ -291,7 +292,6 @@ void DeletePortableDeviceOnBlockingPoolThread(
registered_device_path);
}
-
} // namespace
// Used by CreateMTPDeviceAsyncDelegate() to create the MTP device

Powered by Google App Engine
This is Rietveld 408576698