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

Side by Side Diff: chrome/browser/media_gallery/win/recursive_mtp_device_object_enumerator.h

Issue 11297002: [Media Gallery] Added code to support mtp device media file system on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + Fixed win compile error by implementing GetMTPStorageInfoFromDeviceId in TestStorageNotifi… Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
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>
9
10 #include <queue>
11 #include <vector>
12
13 #include "base/memory/scoped_ptr.h"
14 #include "base/string16.h"
15 #include "base/threading/thread_checker.h"
16 #include "base/time.h"
17 #include "base/win/scoped_comptr.h"
18 #include "chrome/browser/media_gallery/win/mtp_device_object_entry.h"
19 #include "webkit/fileapi/file_system_file_util.h"
20
21 class FilePath;
22
23 namespace chrome {
24
25 // RecursiveMTPDeviceObjectEnumerator is used to recursively enumerate the
26 // media transfer protocol (MTP) device storage objects from a given media file
27 // object entries set. RecursiveMTPDeviceObjectEnumerator communicates with the
28 // MTP device to get the subdirectory object entries.
29 // RecursiveMTPDeviceObjectEnumerator uses MTPDeviceObjectEnumerator to iterate
30 // the current directory objects. RecursiveMTPDeviceObjectEnumerator may only be
31 // used on a single thread.
32 class RecursiveMTPDeviceObjectEnumerator
33 : public fileapi::FileSystemFileUtil::AbstractFileEnumerator {
34 public:
35 // MTP |device| should already be initialized and ready for communication.
36 RecursiveMTPDeviceObjectEnumerator(IPortableDevice* device,
37 const MTPDeviceObjectEntries& entries);
38 virtual ~RecursiveMTPDeviceObjectEnumerator();
39
40 // AbstractFileEnumerator:
41 virtual FilePath Next() OVERRIDE;
42 virtual int64 Size() OVERRIDE;
43 virtual bool IsDirectory() OVERRIDE;
44 virtual base::Time LastModifiedTime() OVERRIDE;
45
46 private:
47 typedef string16 DirectoryObjectId;
48
49 void MaybeUpdateCurrentObjectList();
50
51 // The portable device.
52 base::win::ScopedComPtr<IPortableDevice> device_;
53
54 // TODO(kmadhusu): Remove |curr_object_entries_| and |object_entry_iter_|.
55 // Implement GetObjectId() and HasMoreEntries() in MTPDeviceObjectEnumerator
56 // and remove |curr_object_entries_| and |object_entry_iter_|.
57
58 // List of current directory object entries.
59 MTPDeviceObjectEntries curr_object_entries_;
60
61 // Iterator to access the individual file object entries.
62 MTPDeviceObjectEntries::const_iterator object_entry_iter_;
63
64 // Enumerator to access current directory object entries.
65 scoped_ptr<fileapi::FileSystemFileUtil::AbstractFileEnumerator>
66 current_enumerator_;
67
68 // Used to recursively enumerate the sub-directory objects.
69 std::queue<DirectoryObjectId> unparsed_directory_object_ids_;
70
71 base::ThreadChecker thread_checker_;
72
73 DISALLOW_COPY_AND_ASSIGN(RecursiveMTPDeviceObjectEnumerator);
74 };
75
76 } // namespace chrome
77
78 #endif // CHROME_BROWSER_MEDIA_GALLERY_WIN_RECURSIVE_MTP_DEVICE_OBJECT_ENUMERAT OR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698