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 <string> |
| 9 |
8 #include "base/file_path.h" | 10 #include "base/file_path.h" |
9 #include "base/file_util.h" | 11 #include "base/file_util.h" |
10 #include "net/base/directory_lister.h" | 12 #include "net/base/directory_lister.h" |
11 #include "net/url_request/url_request_job.h" | 13 #include "net/url_request/url_request_job.h" |
12 | 14 |
13 class URLRequestFileDirJob | 15 class URLRequestFileDirJob |
14 : public URLRequestJob, | 16 : public URLRequestJob, |
15 public net::DirectoryLister::DirectoryListerDelegate { | 17 public net::DirectoryLister::DirectoryListerDelegate { |
16 public: | 18 public: |
17 URLRequestFileDirJob(URLRequest* request, const FilePath& dir_path); | 19 URLRequestFileDirJob(URLRequest* request, const FilePath& dir_path); |
18 virtual ~URLRequestFileDirJob(); | 20 virtual ~URLRequestFileDirJob(); |
19 | 21 |
20 // URLRequestJob methods: | 22 // URLRequestJob methods: |
21 virtual void Start(); | 23 virtual void Start(); |
22 virtual void StartAsync(); | 24 virtual void StartAsync(); |
23 virtual void Kill(); | 25 virtual void Kill(); |
24 virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int *bytes_read); | 26 virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int *bytes_read); |
25 virtual bool GetMimeType(std::string* mime_type); | 27 virtual bool GetMimeType(std::string* mime_type) const; |
26 virtual bool GetCharset(std::string* charset); | 28 virtual bool GetCharset(std::string* charset); |
27 virtual bool IsRedirectResponse(GURL* location, int* http_status_code); | 29 virtual bool IsRedirectResponse(GURL* location, int* http_status_code); |
28 | 30 |
29 // DirectoryLister::DirectoryListerDelegate methods: | 31 // DirectoryLister::DirectoryListerDelegate methods: |
30 virtual void OnListFile(const file_util::FileEnumerator::FindInfo& data); | 32 virtual void OnListFile(const file_util::FileEnumerator::FindInfo& data); |
31 virtual void OnListDone(int error); | 33 virtual void OnListDone(int error); |
32 | 34 |
33 private: | 35 private: |
34 void CloseLister(); | 36 void CloseLister(); |
35 // When we have data and a read has been pending, this function | 37 // When we have data and a read has been pending, this function |
(...skipping 20 matching lines...) Expand all Loading... |
56 // manually. | 58 // manually. |
57 bool read_pending_; | 59 bool read_pending_; |
58 scoped_refptr<net::IOBuffer> read_buffer_; | 60 scoped_refptr<net::IOBuffer> read_buffer_; |
59 int read_buffer_length_; | 61 int read_buffer_length_; |
60 | 62 |
61 DISALLOW_EVIL_CONSTRUCTORS(URLRequestFileDirJob); | 63 DISALLOW_EVIL_CONSTRUCTORS(URLRequestFileDirJob); |
62 }; | 64 }; |
63 | 65 |
64 #endif // NET_URL_REQUEST_URL_REQUEST_FILE_DIR_JOB_H__ | 66 #endif // NET_URL_REQUEST_URL_REQUEST_FILE_DIR_JOB_H__ |
65 | 67 |
OLD | NEW |