| 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(char* 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 | 28 |
| 28 // DirectoryLister::DirectoryListerDelegate methods: | 29 // DirectoryLister::DirectoryListerDelegate methods: |
| 29 virtual void OnListFile(const file_util::FileEnumerator::FindInfo& data); | 30 virtual void OnListFile(const file_util::FileEnumerator::FindInfo& data); |
| 30 virtual void OnListDone(int error); | 31 virtual void OnListDone(int error); |
| 31 | 32 |
| 32 private: | 33 private: |
| 33 void CloseLister(); | 34 void CloseLister(); |
| 34 // When we have data and a read has been pending, this function | 35 // When we have data and a read has been pending, this function |
| 35 // will fill the response buffer and notify the request | 36 // will fill the response buffer and notify the request |
| 36 // appropriately. | 37 // appropriately. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 55 // manually. | 56 // manually. |
| 56 bool read_pending_; | 57 bool read_pending_; |
| 57 char *read_buffer_; | 58 char *read_buffer_; |
| 58 int read_buffer_length_; | 59 int read_buffer_length_; |
| 59 | 60 |
| 60 DISALLOW_EVIL_CONSTRUCTORS(URLRequestFileDirJob); | 61 DISALLOW_EVIL_CONSTRUCTORS(URLRequestFileDirJob); |
| 61 }; | 62 }; |
| 62 | 63 |
| 63 #endif // NET_URL_REQUEST_URL_REQUEST_FILE_DIR_JOB_H__ | 64 #endif // NET_URL_REQUEST_URL_REQUEST_FILE_DIR_JOB_H__ |
| 64 | 65 |
| OLD | NEW |