| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_DIR_URL_REQUEST_JOB_H_ | |
| 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_DIR_URL_REQUEST_JOB_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/files/file_path.h" | |
| 12 #include "base/files/file_util_proxy.h" | |
| 13 #include "base/memory/weak_ptr.h" | |
| 14 #include "base/message_loop_proxy.h" | |
| 15 #include "base/platform_file.h" | |
| 16 #include "net/url_request/url_request_job.h" | |
| 17 #include "webkit/fileapi/file_system_url.h" | |
| 18 #include "webkit/storage/webkit_storage_export.h" | |
| 19 | |
| 20 namespace fileapi { | |
| 21 class FileSystemContext; | |
| 22 class FileSystemOperation; | |
| 23 | |
| 24 // A request job that handles reading filesystem: URLs for directories. | |
| 25 class WEBKIT_STORAGE_EXPORT_PRIVATE FileSystemDirURLRequestJob | |
| 26 : public net::URLRequestJob { | |
| 27 public: | |
| 28 FileSystemDirURLRequestJob( | |
| 29 net::URLRequest* request, | |
| 30 net::NetworkDelegate* network_delegate, | |
| 31 FileSystemContext* file_system_context); | |
| 32 | |
| 33 // URLRequestJob methods: | |
| 34 virtual void Start() OVERRIDE; | |
| 35 virtual void Kill() OVERRIDE; | |
| 36 virtual bool ReadRawData(net::IOBuffer* buf, | |
| 37 int buf_size, | |
| 38 int* bytes_read) OVERRIDE; | |
| 39 virtual bool GetCharset(std::string* charset) OVERRIDE; | |
| 40 | |
| 41 // FilterContext methods (via URLRequestJob): | |
| 42 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; | |
| 43 // TODO(adamk): Implement GetResponseInfo and GetResponseCode to simulate | |
| 44 // an HTTP response. | |
| 45 | |
| 46 private: | |
| 47 class CallbackDispatcher; | |
| 48 | |
| 49 virtual ~FileSystemDirURLRequestJob(); | |
| 50 | |
| 51 void StartAsync(); | |
| 52 void DidReadDirectory(base::PlatformFileError result, | |
| 53 const std::vector<base::FileUtilProxy::Entry>& entries, | |
| 54 bool has_more); | |
| 55 FileSystemOperation* GetNewOperation(base::PlatformFileError* error_code); | |
| 56 | |
| 57 std::string data_; | |
| 58 FileSystemURL url_; | |
| 59 FileSystemContext* file_system_context_; | |
| 60 base::WeakPtrFactory<FileSystemDirURLRequestJob> weak_factory_; | |
| 61 | |
| 62 DISALLOW_COPY_AND_ASSIGN(FileSystemDirURLRequestJob); | |
| 63 }; | |
| 64 | |
| 65 } // namespace fileapi | |
| 66 | |
| 67 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_DIR_URL_REQUEST_JOB_H_ | |
| OLD | NEW |