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 NET_BASE_DIRECTORY_LISTER_H_ | 5 #ifndef NET_BASE_DIRECTORY_LISTER_H_ |
6 #define NET_BASE_DIRECTORY_LISTER_H_ | 6 #define NET_BASE_DIRECTORY_LISTER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/file_util.h" | 10 #include "base/files/file_enumerator.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/message_loop_proxy.h" | 13 #include "base/message_loop_proxy.h" |
14 #include "net/base/net_export.h" | 14 #include "net/base/net_export.h" |
15 | 15 |
16 namespace net { | 16 namespace net { |
17 | 17 |
18 // | 18 // |
19 // This class provides an API for listing the contents of a directory on the | 19 // This class provides an API for listing the contents of a directory on the |
20 // filesystem asynchronously. It spawns a background thread, and enumerates | 20 // filesystem asynchronously. It spawns a background thread, and enumerates |
21 // the specified directory on that thread. It marshalls WIN32_FIND_DATA | 21 // the specified directory on that thread. It marshalls WIN32_FIND_DATA |
22 // structs over to the main application thread. The consumer of this class | 22 // structs over to the main application thread. The consumer of this class |
23 // is insulated from any of the multi-threading details. | 23 // is insulated from any of the multi-threading details. |
24 // | 24 // |
25 class NET_EXPORT DirectoryLister { | 25 class NET_EXPORT DirectoryLister { |
26 public: | 26 public: |
27 // Represents one file found. | 27 // Represents one file found. |
28 struct DirectoryListerData { | 28 struct DirectoryListerData { |
29 file_util::FileEnumerator::FindInfo info; | 29 base::FileEnumerator::FileInfo info; |
30 base::FilePath path; | 30 base::FilePath path; |
31 }; | 31 }; |
32 | 32 |
33 // Implement this class to receive directory entries. | 33 // Implement this class to receive directory entries. |
34 class DirectoryListerDelegate { | 34 class DirectoryListerDelegate { |
35 public: | 35 public: |
36 // Called for each file found by the lister. | 36 // Called for each file found by the lister. |
37 virtual void OnListFile(const DirectoryListerData& data) = 0; | 37 virtual void OnListFile(const DirectoryListerData& data) = 0; |
38 | 38 |
39 // Called when the listing is complete. | 39 // Called when the listing is complete. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 114 |
115 const scoped_refptr<Core> core_; | 115 const scoped_refptr<Core> core_; |
116 DirectoryListerDelegate* const delegate_; | 116 DirectoryListerDelegate* const delegate_; |
117 | 117 |
118 DISALLOW_COPY_AND_ASSIGN(DirectoryLister); | 118 DISALLOW_COPY_AND_ASSIGN(DirectoryLister); |
119 }; | 119 }; |
120 | 120 |
121 } // namespace net | 121 } // namespace net |
122 | 122 |
123 #endif // NET_BASE_DIRECTORY_LISTER_H_ | 123 #endif // NET_BASE_DIRECTORY_LISTER_H_ |
OLD | NEW |