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.
5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_OBJECT_ENUMERATOR_H_
6 #define CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_OBJECT_ENUMERATOR_H_
10 #include "base/files/file_path.h"
11 #include "base/time/time.h"
12 #include "device/media_transfer_protocol/mtp_file_entry.pb.h"
14 // Used to enumerate top-level files of an media file system.
15 class MTPDeviceObjectEnumerator
{
17 explicit MTPDeviceObjectEnumerator(const std::vector
<MtpFileEntry
>& entries
);
19 ~MTPDeviceObjectEnumerator();
21 base::FilePath
Next();
24 base::Time
LastModifiedTime();
26 // If the current file entry is valid, returns true and fills in |entry_id|
27 // with the entry identifier else returns false and |entry_id| is not set.
28 bool GetEntryId(uint32
* entry_id
) const;
31 // Returns true if the enumerator has more entries to traverse, false
33 bool HasMoreEntries() const;
35 // Returns true if Next() has been called at least once, and the enumerator
36 // has more entries to traverse.
37 bool IsIndexReadyAndInRange() const;
39 // List of directory file entries information.
40 const std::vector
<MtpFileEntry
> file_entries_
;
42 // Index into |file_entries_|.
43 // Should only be used when |is_index_ready_| is true.
46 // Initially false. Set to true after Next() has been called.
49 DISALLOW_COPY_AND_ASSIGN(MTPDeviceObjectEnumerator
);
52 #endif // CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_OBJECT_ENUMERATOR_H_