OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/file_util.h" |
8 #include "net/base/directory_lister.h" | 9 #include "net/base/directory_lister.h" |
9 #include "net/url_request/url_request_job.h" | 10 #include "net/url_request/url_request_job.h" |
10 | 11 |
11 class URLRequestFileDirJob : public URLRequestJob, | 12 class URLRequestFileDirJob |
12 public net::DirectoryLister::Delegate { | 13 : public URLRequestJob, |
| 14 public net::DirectoryLister::DirectoryListerDelegate { |
13 public: | 15 public: |
14 URLRequestFileDirJob(URLRequest* request, const std::wstring& dir_path); | 16 URLRequestFileDirJob(URLRequest* request, const std::wstring& dir_path); |
15 virtual ~URLRequestFileDirJob(); | 17 virtual ~URLRequestFileDirJob(); |
16 | 18 |
17 // URLRequestJob methods: | 19 // URLRequestJob methods: |
18 virtual void Start(); | 20 virtual void Start(); |
19 virtual void StartAsync(); | 21 virtual void StartAsync(); |
20 virtual void Kill(); | 22 virtual void Kill(); |
21 virtual bool ReadRawData(char* buf, int buf_size, int *bytes_read); | 23 virtual bool ReadRawData(char* buf, int buf_size, int *bytes_read); |
22 virtual bool GetMimeType(std::string* mime_type); | 24 virtual bool GetMimeType(std::string* mime_type); |
23 virtual bool GetCharset(std::string* charset); | 25 virtual bool GetCharset(std::string* charset); |
24 | 26 |
25 // DirectoryLister::Delegate methods: | 27 // DirectoryLister::DirectoryListerDelegate methods: |
26 virtual void OnListFile(const WIN32_FIND_DATA& data); | 28 virtual void OnListFile(const file_util::FileEnumerator::FindInfo& data); |
27 virtual void OnListDone(int error); | 29 virtual void OnListDone(int error); |
28 | 30 |
29 private: | 31 private: |
30 void CloseLister(); | 32 void CloseLister(); |
31 // When we have data and a read has been pending, this function | 33 // When we have data and a read has been pending, this function |
32 // will fill the response buffer and notify the request | 34 // will fill the response buffer and notify the request |
33 // appropriately. | 35 // appropriately. |
34 void CompleteRead(); | 36 void CompleteRead(); |
35 | 37 |
36 // Fills a buffer with the output. | 38 // Fills a buffer with the output. |
(...skipping 15 matching lines...) Expand all Loading... |
52 // manually. | 54 // manually. |
53 bool read_pending_; | 55 bool read_pending_; |
54 char *read_buffer_; | 56 char *read_buffer_; |
55 int read_buffer_length_; | 57 int read_buffer_length_; |
56 | 58 |
57 DISALLOW_EVIL_CONSTRUCTORS(URLRequestFileDirJob); | 59 DISALLOW_EVIL_CONSTRUCTORS(URLRequestFileDirJob); |
58 }; | 60 }; |
59 | 61 |
60 #endif // NET_URL_REQUEST_URL_REQUEST_FILE_DIR_JOB_H__ | 62 #endif // NET_URL_REQUEST_URL_REQUEST_FILE_DIR_JOB_H__ |
61 | 63 |
OLD | NEW |