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_path.h" | 8 #include "base/file_path.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "net/base/directory_lister.h" | 10 #include "net/base/directory_lister.h" |
11 #include "net/url_request/url_request_job.h" | 11 #include "net/url_request/url_request_job.h" |
12 | 12 |
13 class URLRequestFileDirJob | 13 class URLRequestFileDirJob |
14 : public URLRequestJob, | 14 : public URLRequestJob, |
15 public net::DirectoryLister::DirectoryListerDelegate { | 15 public net::DirectoryLister::DirectoryListerDelegate { |
16 public: | 16 public: |
17 URLRequestFileDirJob(URLRequest* request, const FilePath& dir_path); | 17 URLRequestFileDirJob(URLRequest* request, const FilePath& dir_path); |
18 virtual ~URLRequestFileDirJob(); | 18 virtual ~URLRequestFileDirJob(); |
19 | 19 |
20 // URLRequestJob methods: | 20 // URLRequestJob methods: |
21 virtual void Start(); | 21 virtual void Start(); |
22 virtual void StartAsync(); | 22 virtual void StartAsync(); |
23 virtual void Kill(); | 23 virtual void Kill(); |
24 virtual bool ReadRawData(char* buf, int buf_size, int *bytes_read); | 24 virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int *bytes_read); |
25 virtual bool GetMimeType(std::string* mime_type); | 25 virtual bool GetMimeType(std::string* mime_type); |
26 virtual bool GetCharset(std::string* charset); | 26 virtual bool GetCharset(std::string* charset); |
27 virtual bool IsRedirectResponse(GURL* location, int* http_status_code); | 27 virtual bool IsRedirectResponse(GURL* location, int* http_status_code); |
28 | 28 |
29 // DirectoryLister::DirectoryListerDelegate methods: | 29 // DirectoryLister::DirectoryListerDelegate methods: |
30 virtual void OnListFile(const file_util::FileEnumerator::FindInfo& data); | 30 virtual void OnListFile(const file_util::FileEnumerator::FindInfo& data); |
31 virtual void OnListDone(int error); | 31 virtual void OnListDone(int error); |
32 | 32 |
33 private: | 33 private: |
34 void CloseLister(); | 34 void CloseLister(); |
(...skipping 13 matching lines...) Expand all Loading... |
48 // Indicates whether we have the complete list of the dir | 48 // Indicates whether we have the complete list of the dir |
49 bool list_complete_; | 49 bool list_complete_; |
50 | 50 |
51 // Indicates whether we have written the HTML header | 51 // Indicates whether we have written the HTML header |
52 bool wrote_header_; | 52 bool wrote_header_; |
53 | 53 |
54 // To simulate Async IO, we hold onto the Reader's buffer while | 54 // To simulate Async IO, we hold onto the Reader's buffer while |
55 // we wait for IO to complete. When done, we fill the buffer | 55 // we wait for IO to complete. When done, we fill the buffer |
56 // manually. | 56 // manually. |
57 bool read_pending_; | 57 bool read_pending_; |
58 char *read_buffer_; | 58 scoped_refptr<net::IOBuffer> read_buffer_; |
59 int read_buffer_length_; | 59 int read_buffer_length_; |
60 | 60 |
61 DISALLOW_EVIL_CONSTRUCTORS(URLRequestFileDirJob); | 61 DISALLOW_EVIL_CONSTRUCTORS(URLRequestFileDirJob); |
62 }; | 62 }; |
63 | 63 |
64 #endif // NET_URL_REQUEST_URL_REQUEST_FILE_DIR_JOB_H__ | 64 #endif // NET_URL_REQUEST_URL_REQUEST_FILE_DIR_JOB_H__ |
65 | 65 |
OLD | NEW |