OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_OBJECT_ENUMERATOR_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_OBJECT_ENUMERATOR_H_ |
6 #define CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_OBJECT_ENUMERATOR_H_ | 6 #define CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_OBJECT_ENUMERATOR_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "device/media_transfer_protocol/mtp_file_entry.pb.h" | 12 #include "device/media_transfer_protocol/mtp_file_entry.pb.h" |
13 | 13 |
14 // Used to enumerate top-level files of an media file system. | 14 // Used to enumerate top-level files of an media file system. |
15 class MTPDeviceObjectEnumerator { | 15 class MTPDeviceObjectEnumerator { |
16 public: | 16 public: |
17 explicit MTPDeviceObjectEnumerator(const std::vector<MtpFileEntry>& entries); | 17 explicit MTPDeviceObjectEnumerator(const std::vector<MtpFileEntry>& entries); |
18 | 18 |
19 ~MTPDeviceObjectEnumerator(); | 19 ~MTPDeviceObjectEnumerator(); |
20 | 20 |
21 base::FilePath Next(); | 21 base::FilePath Next(); |
22 int64 Size(); | 22 int64 Size(); |
23 bool IsDirectory(); | 23 bool IsDirectory(); |
24 base::Time LastModifiedTime(); | 24 base::Time LastModifiedTime(); |
25 | 25 |
26 // If the current file entry is valid, returns true and fills in |entry_id| | 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. | 27 // with the entry identifier else returns false and |entry_id| is not set. |
28 bool GetEntryId(uint32_t* entry_id) const; | 28 bool GetEntryId(uint32* entry_id) const; |
tommycli
2014/07/09 19:14:42
base/basictypes.h says to use uint32_t
Lei Zhang
2014/07/09 19:21:40
That happened 6 months ago and all this code was w
| |
29 | 29 |
30 private: | 30 private: |
31 // Returns true if the enumerator has more entries to traverse, false | 31 // Returns true if the enumerator has more entries to traverse, false |
32 // otherwise. | 32 // otherwise. |
33 bool HasMoreEntries() const; | 33 bool HasMoreEntries() const; |
34 | 34 |
35 // Returns true if Next() has been called at least once, and the enumerator | 35 // Returns true if Next() has been called at least once, and the enumerator |
36 // has more entries to traverse. | 36 // has more entries to traverse. |
37 bool IsIndexReadyAndInRange() const; | 37 bool IsIndexReadyAndInRange() const; |
38 | 38 |
39 // List of directory file entries information. | 39 // List of directory file entries information. |
40 const std::vector<MtpFileEntry> file_entries_; | 40 const std::vector<MtpFileEntry> file_entries_; |
41 | 41 |
42 // Index into |file_entries_|. | 42 // Index into |file_entries_|. |
43 // Should only be used when |is_index_ready_| is true. | 43 // Should only be used when |is_index_ready_| is true. |
44 size_t index_; | 44 size_t index_; |
45 | 45 |
46 // Initially false. Set to true after Next() has been called. | 46 // Initially false. Set to true after Next() has been called. |
47 bool is_index_ready_; | 47 bool is_index_ready_; |
48 | 48 |
49 DISALLOW_COPY_AND_ASSIGN(MTPDeviceObjectEnumerator); | 49 DISALLOW_COPY_AND_ASSIGN(MTPDeviceObjectEnumerator); |
50 }; | 50 }; |
51 | 51 |
52 #endif // CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_OBJECT_ENUMERATOR_H_ | 52 #endif // CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_OBJECT_ENUMERATOR_H_ |
OLD | NEW |