| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 WEBKIT_FILEAPI_FILE_SYSTEM_URL_REQUEST_JOB_H_ | 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_URL_REQUEST_JOB_H_ |
| 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_URL_REQUEST_JOB_H_ | 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_URL_REQUEST_JOB_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/message_loop_proxy.h" | 14 #include "base/message_loop_proxy.h" |
| 15 #include "base/platform_file.h" | 15 #include "base/platform_file.h" |
| 16 #include "net/http/http_byte_range.h" | 16 #include "net/http/http_byte_range.h" |
| 17 #include "net/url_request/url_request_job.h" | 17 #include "net/url_request/url_request_job.h" |
| 18 | 18 |
| 19 class GURL; | 19 class GURL; |
| 20 class FilePath; | 20 class FilePath; |
| 21 | 21 |
| 22 namespace webkit_blob { | |
| 23 class LocalFileReader; | |
| 24 class ShareableFileReference; | |
| 25 } | |
| 26 | |
| 27 namespace fileapi { | 22 namespace fileapi { |
| 28 class FileSystemContext; | 23 class FileSystemContext; |
| 24 class FileSystemFileReader; |
| 29 | 25 |
| 30 // A request job that handles reading filesystem: URLs | 26 // A request job that handles reading filesystem: URLs |
| 31 class FileSystemURLRequestJob : public net::URLRequestJob { | 27 class FileSystemURLRequestJob : public net::URLRequestJob { |
| 32 public: | 28 public: |
| 33 FileSystemURLRequestJob( | 29 FileSystemURLRequestJob( |
| 34 net::URLRequest* request, | 30 net::URLRequest* request, |
| 35 FileSystemContext* file_system_context, | 31 FileSystemContext* file_system_context, |
| 36 scoped_refptr<base::MessageLoopProxy> file_thread_proxy); | 32 scoped_refptr<base::MessageLoopProxy> file_thread_proxy); |
| 37 | 33 |
| 38 // URLRequestJob methods: | 34 // URLRequestJob methods: |
| (...skipping 11 matching lines...) Expand all Loading... |
| 50 | 46 |
| 51 // FilterContext methods (via URLRequestJob): | 47 // FilterContext methods (via URLRequestJob): |
| 52 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; | 48 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; |
| 53 | 49 |
| 54 private: | 50 private: |
| 55 class CallbackDispatcher; | 51 class CallbackDispatcher; |
| 56 | 52 |
| 57 virtual ~FileSystemURLRequestJob(); | 53 virtual ~FileSystemURLRequestJob(); |
| 58 | 54 |
| 59 void StartAsync(); | 55 void StartAsync(); |
| 60 void DidCreateSnapshot( | 56 void DidGetMetadata( |
| 61 base::PlatformFileError error_code, | 57 base::PlatformFileError error_code, |
| 62 const base::PlatformFileInfo& file_info, | 58 const base::PlatformFileInfo& file_info, |
| 63 const FilePath& platform_path, | 59 const FilePath& platform_path); |
| 64 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref); | |
| 65 void DidOpen(base::PlatformFileError error_code, | |
| 66 base::PassPlatformFile file, bool created); | |
| 67 void DidRead(int result); | 60 void DidRead(int result); |
| 68 void NotifyFailed(int rv); | 61 void NotifyFailed(int rv); |
| 69 | 62 |
| 70 FileSystemContext* file_system_context_; | 63 FileSystemContext* file_system_context_; |
| 71 scoped_refptr<base::MessageLoopProxy> file_thread_proxy_; | 64 scoped_refptr<base::MessageLoopProxy> file_thread_proxy_; |
| 72 base::WeakPtrFactory<FileSystemURLRequestJob> weak_factory_; | 65 base::WeakPtrFactory<FileSystemURLRequestJob> weak_factory_; |
| 73 scoped_ptr<webkit_blob::LocalFileReader> reader_; | 66 scoped_ptr<FileSystemFileReader> reader_; |
| 74 scoped_refptr<webkit_blob::ShareableFileReference> snapshot_ref_; | |
| 75 bool is_directory_; | 67 bool is_directory_; |
| 76 scoped_ptr<net::HttpResponseInfo> response_info_; | 68 scoped_ptr<net::HttpResponseInfo> response_info_; |
| 77 int64 remaining_bytes_; | 69 int64 remaining_bytes_; |
| 78 net::HttpByteRange byte_range_; | 70 net::HttpByteRange byte_range_; |
| 79 | 71 |
| 80 DISALLOW_COPY_AND_ASSIGN(FileSystemURLRequestJob); | 72 DISALLOW_COPY_AND_ASSIGN(FileSystemURLRequestJob); |
| 81 }; | 73 }; |
| 82 | 74 |
| 83 } // namespace fileapi | 75 } // namespace fileapi |
| 84 | 76 |
| 85 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_URL_REQUEST_JOB_H_ | 77 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_URL_REQUEST_JOB_H_ |
| OLD | NEW |