Chromium Code Reviews| 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 #ifndef CHROME_BROWSER_MEDIA_GALLERY_WIN_RECURSIVE_MTP_DEVICE_OBJECT_ENUMERATOR_ H_ | |
| 6 #define CHROME_BROWSER_MEDIA_GALLERY_WIN_RECURSIVE_MTP_DEVICE_OBJECT_ENUMERATOR_ H_ | |
| 7 | |
| 8 #include <portabledeviceapi.h> | |
|
Lei Zhang
2013/01/14 23:25:30
nit: empty line between C and C++ headers. Here an
kmadhusu
2013/01/15 19:08:17
I had an empty line before. Reviewers asked me to
Lei Zhang
2013/01/15 21:00:13
I ran into the same issue on my readability review
kmadhusu
2013/01/15 23:41:58
Done.
| |
| 9 #include <queue> | |
| 10 #include <vector> | |
| 11 | |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "base/string16.h" | |
| 14 #include "base/threading/thread_checker.h" | |
| 15 #include "base/time.h" | |
| 16 #include "base/win/scoped_comptr.h" | |
| 17 #include "chrome/browser/media_gallery/win/mtp_device_object_entry.h" | |
| 18 #include "webkit/fileapi/file_system_file_util.h" | |
| 19 | |
| 20 class FilePath; | |
| 21 | |
| 22 namespace chrome { | |
| 23 | |
| 24 // RecursiveMTPDeviceObjectEnumerator is used to recursively enumerate the | |
| 25 // media transfer protocol (MTP) device storage objects from a given media file | |
| 26 // object entries set. RecursiveMTPDeviceObjectEnumerator communicates with the | |
|
Lei Zhang
2013/01/14 23:25:30
Doesn't it go through MTPDeviceObjectEnumerator?
kmadhusu
2013/01/15 19:08:17
RecursiveMTPDeviceObjectEnumerator communicates wi
Lei Zhang
2013/01/15 21:00:13
That should have gone in the comments and not in t
kmadhusu
2013/01/15 23:41:58
Done.
| |
| 27 // MTP device to get the removable storage objects details. | |
| 28 // RecursiveMTPDeviceObjectEnumerator supports media file system operations. | |
|
Lei Zhang
2013/01/14 23:25:30
What does this mean exactly? Are you trying to say
kmadhusu
2013/01/15 19:08:17
RecursiveMTPDeviceObjectEnumerator is used to comp
Lei Zhang
2013/01/15 21:00:13
Ok, but I don't see how this comment is useful. Ar
kmadhusu
2013/01/15 23:41:58
Removed.
| |
| 29 // RecursiveMTPDeviceObjectEnumerator may only be used on a single thread. MTP | |
| 30 // device is already opened for communication. | |
|
Lei Zhang
2013/01/14 23:25:30
Are you trying to say the |device| passed into the
kmadhusu
2013/01/15 19:08:17
Done.
| |
| 31 class RecursiveMTPDeviceObjectEnumerator | |
| 32 : public fileapi::FileSystemFileUtil::AbstractFileEnumerator { | |
| 33 public: | |
| 34 RecursiveMTPDeviceObjectEnumerator(IPortableDevice* device, | |
| 35 const MTPDeviceObjectEntries& entries); | |
| 36 virtual ~RecursiveMTPDeviceObjectEnumerator(); | |
| 37 | |
| 38 // AbstractFileEnumerator: | |
| 39 virtual FilePath Next() OVERRIDE; | |
| 40 virtual int64 Size() OVERRIDE; | |
| 41 virtual bool IsDirectory() OVERRIDE; | |
| 42 virtual base::Time LastModifiedTime() OVERRIDE; | |
| 43 | |
| 44 private: | |
| 45 typedef string16 DirectoryObjectId; | |
| 46 | |
| 47 void MaybeUpdateCurrentObjectList(); | |
| 48 | |
| 49 // The portable device. | |
| 50 base::win::ScopedComPtr<IPortableDevice> device_; | |
| 51 | |
| 52 // List of current directory object entries. | |
|
Lei Zhang
2013/01/14 23:25:30
Can you add a TODO to remove |curr_object_entries_
kmadhusu
2013/01/15 19:08:17
Done.
| |
| 53 MTPDeviceObjectEntries curr_object_entries_; | |
| 54 | |
| 55 // Iterator to access the individual file object entries. | |
| 56 MTPDeviceObjectEntries::const_iterator object_entry_iter_; | |
| 57 | |
| 58 // Enumerator to access current directory object entries. | |
| 59 scoped_ptr<fileapi::FileSystemFileUtil::AbstractFileEnumerator> | |
| 60 current_enumerator_; | |
| 61 | |
| 62 // Used to recursively enumerate the sub-directory objects. | |
| 63 std::queue<DirectoryObjectId> unparsed_directory_object_ids_; | |
| 64 | |
| 65 base::ThreadChecker thread_checker_; | |
| 66 | |
| 67 DISALLOW_COPY_AND_ASSIGN(RecursiveMTPDeviceObjectEnumerator); | |
| 68 }; | |
| 69 | |
| 70 } // namespace chrome | |
| 71 | |
| 72 #endif // CHROME_BROWSER_MEDIA_GALLERY_WIN_RECURSIVE_MTP_DEVICE_OBJECT_ENUMERAT OR_H_ | |
| OLD | NEW |