Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / media_galleries / linux / mtp_device_object_enumerator.h
blob7f8b611f523a04a0ee2e8dc07e76cbb19198eee5
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_
8 #include <vector>
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 {
16 public:
17 explicit MTPDeviceObjectEnumerator(const std::vector<MtpFileEntry>& entries);
19 ~MTPDeviceObjectEnumerator();
21 base::FilePath Next();
22 int64 Size();
23 bool IsDirectory();
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_t* entry_id) const;
30 private:
31 // Returns true if the enumerator has more entries to traverse, false
32 // otherwise.
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.
44 size_t index_;
46 // Initially false. Set to true after Next() has been called.
47 bool is_index_ready_;
49 DISALLOW_COPY_AND_ASSIGN(MTPDeviceObjectEnumerator);
52 #endif // CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_OBJECT_ENUMERATOR_H_