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

Side by Side Diff: chrome/browser/media_galleries/linux/mtp_device_object_enumerator.h

Issue 27094003: Remove fileapi::FileSystemFileUtil dependency in media gallery code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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
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 #include "webkit/browser/fileapi/file_system_file_util.h"
14 13
15 // Used to enumerate top-level files of an media file system. 14 // Used to enumerate top-level files of an media file system.
16 class MTPDeviceObjectEnumerator 15 class MTPDeviceObjectEnumerator {
17 : public fileapi::FileSystemFileUtil::AbstractFileEnumerator {
18 public: 16 public:
19 explicit MTPDeviceObjectEnumerator(const std::vector<MtpFileEntry>& entries); 17 explicit MTPDeviceObjectEnumerator(const std::vector<MtpFileEntry>& entries);
20 18
21 virtual ~MTPDeviceObjectEnumerator(); 19 ~MTPDeviceObjectEnumerator();
22 20
23 // AbstractFileEnumerator: 21 base::FilePath Next();
24 virtual base::FilePath Next() OVERRIDE; 22 int64 Size();
25 virtual int64 Size() OVERRIDE; 23 bool IsDirectory();
26 virtual bool IsDirectory() OVERRIDE; 24 base::Time LastModifiedTime();
27 virtual base::Time LastModifiedTime() OVERRIDE;
28 25
29 // 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|
30 // 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.
31 bool GetEntryId(uint32_t* entry_id) const; 28 bool GetEntryId(uint32_t* entry_id) const;
32 29
33 private: 30 private:
34 // Returns true if the enumerator has more entries to traverse, false 31 // Returns true if the enumerator has more entries to traverse, false
35 // otherwise. 32 // otherwise.
36 bool HasMoreEntries() const; 33 bool HasMoreEntries() const;
37 34
38 // 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
39 // has more entries to traverse. 36 // has more entries to traverse.
40 bool IsIndexReadyAndInRange() const; 37 bool IsIndexReadyAndInRange() const;
41 38
42 // List of directory file entries information. 39 // List of directory file entries information.
43 const std::vector<MtpFileEntry> file_entries_; 40 const std::vector<MtpFileEntry> file_entries_;
44 41
45 // Index into |file_entries_|. 42 // Index into |file_entries_|.
46 // Should only be used when |is_index_ready_| is true. 43 // Should only be used when |is_index_ready_| is true.
47 size_t index_; 44 size_t index_;
48 45
49 // Initially false. Set to true after Next() has been called. 46 // Initially false. Set to true after Next() has been called.
50 bool is_index_ready_; 47 bool is_index_ready_;
51 48
52 DISALLOW_COPY_AND_ASSIGN(MTPDeviceObjectEnumerator); 49 DISALLOW_COPY_AND_ASSIGN(MTPDeviceObjectEnumerator);
53 }; 50 };
54 51
55 #endif // CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_OBJECT_ENUMERATOR_H_ 52 #endif // CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_OBJECT_ENUMERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698