| OLD | NEW | 
|---|
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <string> | 8 #include <string> | 
| 9 | 9 | 
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" | 
| (...skipping 17 matching lines...) Expand all  Loading... | 
| 28  public: | 28  public: | 
| 29   // Implement this class to receive directory entries. | 29   // Implement this class to receive directory entries. | 
| 30   class DirectoryListerDelegate { | 30   class DirectoryListerDelegate { | 
| 31    public: | 31    public: | 
| 32     virtual void OnListFile( | 32     virtual void OnListFile( | 
| 33         const file_util::FileEnumerator::FindInfo& data) = 0; | 33         const file_util::FileEnumerator::FindInfo& data) = 0; | 
| 34     virtual void OnListDone(int error) = 0; | 34     virtual void OnListDone(int error) = 0; | 
| 35   }; | 35   }; | 
| 36 | 36 | 
| 37   DirectoryLister(const FilePath& dir, DirectoryListerDelegate* delegate); | 37   DirectoryLister(const FilePath& dir, DirectoryListerDelegate* delegate); | 
| 38   ~DirectoryLister(); |  | 
| 39 | 38 | 
| 40   // Call this method to start the directory enumeration thread. | 39   // Call this method to start the directory enumeration thread. | 
| 41   bool Start(); | 40   bool Start(); | 
| 42 | 41 | 
| 43   // Call this method to asynchronously stop directory enumeration.  The | 42   // Call this method to asynchronously stop directory enumeration.  The | 
| 44   // delegate will receive the OnListDone notification with an error code of | 43   // delegate will receive the OnListDone notification with an error code of | 
| 45   // net::ERR_ABORTED. | 44   // net::ERR_ABORTED. | 
| 46   void Cancel(); | 45   void Cancel(); | 
| 47 | 46 | 
| 48   // The delegate pointer may be modified at any time. | 47   // The delegate pointer may be modified at any time. | 
| 49   DirectoryListerDelegate* delegate() const { return delegate_; } | 48   DirectoryListerDelegate* delegate() const { return delegate_; } | 
| 50   void set_delegate(DirectoryListerDelegate* d) { delegate_ = d; } | 49   void set_delegate(DirectoryListerDelegate* d) { delegate_ = d; } | 
| 51 | 50 | 
| 52   // PlatformThread::Delegate implementation | 51   // PlatformThread::Delegate implementation | 
| 53   void ThreadMain(); | 52   void ThreadMain(); | 
| 54 | 53 | 
| 55  private: | 54  private: | 
|  | 55   friend class base::RefCountedThreadSafe<DirectoryLister>; | 
| 56   friend class DirectoryDataEvent; | 56   friend class DirectoryDataEvent; | 
| 57 | 57 | 
|  | 58   ~DirectoryLister(); | 
|  | 59 | 
| 58   void OnReceivedData(const file_util::FileEnumerator::FindInfo* data, | 60   void OnReceivedData(const file_util::FileEnumerator::FindInfo* data, | 
| 59                       int count); | 61                       int count); | 
| 60   void OnDone(int error); | 62   void OnDone(int error); | 
| 61 | 63 | 
| 62   FilePath dir_; | 64   FilePath dir_; | 
| 63   DirectoryListerDelegate* delegate_; | 65   DirectoryListerDelegate* delegate_; | 
| 64   MessageLoop* message_loop_; | 66   MessageLoop* message_loop_; | 
| 65   PlatformThreadHandle thread_; | 67   PlatformThreadHandle thread_; | 
| 66   bool canceled_; | 68   bool canceled_; | 
| 67 }; | 69 }; | 
| 68 | 70 | 
| 69 }  // namespace net | 71 }  // namespace net | 
| 70 | 72 | 
| 71 #endif  // NET_BASE_DIRECTORY_LISTER_H_ | 73 #endif  // NET_BASE_DIRECTORY_LISTER_H_ | 
| OLD | NEW | 
|---|