OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_URL_REQUEST_URL_REQUEST_FILE_DIR_JOB_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_FILE_DIR_JOB_H_ |
6 #define NET_URL_REQUEST_URL_REQUEST_FILE_DIR_JOB_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_FILE_DIR_JOB_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/file_util.h" | |
11 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
12 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
13 #include "net/base/directory_lister.h" | 12 #include "net/base/directory_lister.h" |
14 #include "net/url_request/url_request_job.h" | 13 #include "net/url_request/url_request_job.h" |
15 | 14 |
16 namespace net { | 15 namespace net { |
17 | 16 |
18 class URLRequestFileDirJob | 17 class URLRequestFileDirJob |
19 : public URLRequestJob, | 18 : public URLRequestJob, |
20 public DirectoryLister::DirectoryListerDelegate { | 19 public DirectoryLister::DirectoryListerDelegate { |
21 public: | 20 public: |
22 URLRequestFileDirJob(URLRequest* request, | 21 URLRequestFileDirJob(URLRequest* request, |
23 NetworkDelegate* network_delegate, | 22 NetworkDelegate* network_delegate, |
24 const base::FilePath& dir_path); | 23 const base::FilePath& dir_path); |
25 | 24 |
26 bool list_complete() const { return list_complete_; } | 25 bool list_complete() const { return list_complete_; } |
27 | 26 |
28 virtual void StartAsync(); | 27 virtual void StartAsync(); |
29 | 28 |
30 // Overridden from URLRequestJob: | 29 // Overridden from URLRequestJob: |
31 virtual void Start() OVERRIDE; | 30 virtual void Start() OVERRIDE; |
32 virtual void Kill() OVERRIDE; | 31 virtual void Kill() OVERRIDE; |
33 virtual bool ReadRawData(IOBuffer* buf, | 32 virtual bool ReadRawData(IOBuffer* buf, |
34 int buf_size, | 33 int buf_size, |
35 int *bytes_read) OVERRIDE; | 34 int* bytes_read) OVERRIDE; |
36 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; | 35 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; |
37 virtual bool GetCharset(std::string* charset) OVERRIDE; | 36 virtual bool GetCharset(std::string* charset) OVERRIDE; |
38 | 37 |
39 // Overridden from DirectoryLister::DirectoryListerDelegate: | 38 // Overridden from DirectoryLister::DirectoryListerDelegate: |
40 virtual void OnListFile( | 39 virtual void OnListFile( |
41 const DirectoryLister::DirectoryListerData& data) OVERRIDE; | 40 const DirectoryLister::DirectoryListerData& data) OVERRIDE; |
42 virtual void OnListDone(int error) OVERRIDE; | 41 virtual void OnListDone(int error) OVERRIDE; |
43 | 42 |
44 private: | 43 private: |
45 virtual ~URLRequestFileDirJob(); | 44 virtual ~URLRequestFileDirJob(); |
(...skipping 26 matching lines...) Expand all Loading... |
72 scoped_refptr<IOBuffer> read_buffer_; | 71 scoped_refptr<IOBuffer> read_buffer_; |
73 int read_buffer_length_; | 72 int read_buffer_length_; |
74 base::WeakPtrFactory<URLRequestFileDirJob> weak_factory_; | 73 base::WeakPtrFactory<URLRequestFileDirJob> weak_factory_; |
75 | 74 |
76 DISALLOW_COPY_AND_ASSIGN(URLRequestFileDirJob); | 75 DISALLOW_COPY_AND_ASSIGN(URLRequestFileDirJob); |
77 }; | 76 }; |
78 | 77 |
79 } // namespace net | 78 } // namespace net |
80 | 79 |
81 #endif // NET_URL_REQUEST_URL_REQUEST_FILE_DIR_JOB_H_ | 80 #endif // NET_URL_REQUEST_URL_REQUEST_FILE_DIR_JOB_H_ |
OLD | NEW |