| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 // |
| 5 // Worker class to recursively enumerate the portable media transfer protocol |
| 6 // (MTP) device storage objects. This class communicates with the portable |
| 7 // device to get the removable storage objects details. This class is created, |
| 8 // destroyed and operated on the blocking thread. MTP device is already opened |
| 9 // for communication. This class supports media file system operations. |
| 10 |
| 11 #ifndef CHROME_BROWSER_MEDIA_GALLERY_WIN_RECURSIVE_MTP_DEVICE_OBJECT_ENUMERATOR_
H_ |
| 12 #define CHROME_BROWSER_MEDIA_GALLERY_WIN_RECURSIVE_MTP_DEVICE_OBJECT_ENUMERATOR_
H_ |
| 13 |
| 14 #include <portabledeviceapi.h> |
| 15 #include <vector> |
| 16 |
| 17 #include "base/memory/scoped_ptr.h" |
| 18 #include "base/threading/thread_checker.h" |
| 19 #include "base/time.h" |
| 20 #include "base/win/scoped_comptr.h" |
| 21 #include "chrome/browser/media_gallery/win/mtp_device_object_entry.h" |
| 22 #include "webkit/fileapi/file_system_file_util.h" |
| 23 |
| 24 class FilePath; |
| 25 |
| 26 namespace chrome { |
| 27 |
| 28 // Recursively enumerates MTP device storage objects from a given media file |
| 29 // object entries set. |
| 30 class RecursiveMTPDeviceObjectEnumerator |
| 31 : public fileapi::FileSystemFileUtil::AbstractFileEnumerator { |
| 32 public: |
| 33 RecursiveMTPDeviceObjectEnumerator(IPortableDevice* device, |
| 34 const MTPDeviceObjectEntries& entries); |
| 35 virtual ~RecursiveMTPDeviceObjectEnumerator(); |
| 36 |
| 37 // AbstractFileEnumerator: |
| 38 virtual FilePath Next() OVERRIDE; |
| 39 virtual int64 Size() OVERRIDE; |
| 40 virtual bool IsDirectory() OVERRIDE; |
| 41 virtual base::Time LastModifiedTime() OVERRIDE; |
| 42 |
| 43 private: |
| 44 // The portable device. |
| 45 base::win::ScopedComPtr<IPortableDevice> device_; |
| 46 |
| 47 // List of top-level directory object entries. |
| 48 const MTPDeviceObjectEntries object_entries_; |
| 49 |
| 50 // Iterator to access the individual file object entries. |
| 51 MTPDeviceObjectEntries::const_iterator object_entry_iter_; |
| 52 |
| 53 // Enumerator to access current directory object entries. |
| 54 scoped_ptr<fileapi::FileSystemFileUtil::AbstractFileEnumerator> |
| 55 current_enumerator_; |
| 56 |
| 57 base::ThreadChecker thread_checker_; |
| 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(RecursiveMTPDeviceObjectEnumerator); |
| 60 }; |
| 61 |
| 62 } // namespace chrome |
| 63 |
| 64 #endif // CHROME_BROWSER_MEDIA_GALLERY_WIN_RECURSIVE_MTP_DEVICE_OBJECT_ENUMERAT
OR_H_ |
| OLD | NEW |