Chromium Code Reviews| 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/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 13 #include "base/message_loop_proxy.h" | 14 #include "base/message_loop_proxy.h" |
| 14 #include "base/platform_file.h" | 15 #include "base/platform_file.h" |
| 15 #include "net/http/http_byte_range.h" | 16 #include "net/http/http_byte_range.h" |
| 16 #include "net/url_request/url_request_job.h" | 17 #include "net/url_request/url_request_job.h" |
| 17 | 18 |
| 18 class GURL; | 19 class GURL; |
| 19 class FilePath; | 20 class FilePath; |
| 20 | 21 |
| 21 namespace net { | 22 namespace net { |
| 22 class FileStream; | 23 class FileStream; |
| 23 } | 24 } |
| 24 | 25 |
| 26 namespace webkit_blob { | |
| 27 class ShareableFileReference; | |
| 28 } | |
| 29 | |
| 25 namespace fileapi { | 30 namespace fileapi { |
| 26 class FileSystemContext; | 31 class FileSystemContext; |
| 27 | 32 |
| 28 // A request job that handles reading filesystem: URLs | 33 // A request job that handles reading filesystem: URLs |
| 29 class FileSystemURLRequestJob : public net::URLRequestJob { | 34 class FileSystemURLRequestJob : public net::URLRequestJob { |
| 30 public: | 35 public: |
| 31 FileSystemURLRequestJob( | 36 FileSystemURLRequestJob( |
| 32 net::URLRequest* request, | 37 net::URLRequest* request, |
| 33 FileSystemContext* file_system_context, | 38 FileSystemContext* file_system_context, |
| 34 scoped_refptr<base::MessageLoopProxy> file_thread_proxy); | 39 scoped_refptr<base::MessageLoopProxy> file_thread_proxy); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 48 | 53 |
| 49 // FilterContext methods (via URLRequestJob): | 54 // FilterContext methods (via URLRequestJob): |
| 50 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; | 55 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; |
| 51 | 56 |
| 52 private: | 57 private: |
| 53 class CallbackDispatcher; | 58 class CallbackDispatcher; |
| 54 | 59 |
| 55 virtual ~FileSystemURLRequestJob(); | 60 virtual ~FileSystemURLRequestJob(); |
| 56 | 61 |
| 57 void StartAsync(); | 62 void StartAsync(); |
| 58 void DidGetMetadata(base::PlatformFileError error_code, | 63 void DidCreateSnapshot( |
| 59 const base::PlatformFileInfo& file_info, | 64 base::PlatformFileError error_code, |
| 60 const FilePath& platform_path); | 65 const base::PlatformFileInfo& file_info, |
| 66 const FilePath& platform_path, | |
| 67 const scoped_refptr<webkit_blob::ShareableFileReference>& | |
| 68 deletable_file_Ref); | |
|
michaeln
2012/03/02 01:55:18
might just say file_ref, definitely nix the cap 'R
kinuko
2012/03/02 02:20:38
Done.
| |
| 61 void DidOpen(base::PlatformFileError error_code, | 69 void DidOpen(base::PlatformFileError error_code, |
| 62 base::PassPlatformFile file, bool created); | 70 base::PassPlatformFile file, bool created); |
| 63 void DidRead(int result); | 71 void DidRead(int result); |
| 64 void NotifyFailed(int rv); | 72 void NotifyFailed(int rv); |
| 65 | 73 |
| 66 FileSystemContext* file_system_context_; | 74 FileSystemContext* file_system_context_; |
| 67 scoped_refptr<base::MessageLoopProxy> file_thread_proxy_; | 75 scoped_refptr<base::MessageLoopProxy> file_thread_proxy_; |
| 68 base::WeakPtrFactory<FileSystemURLRequestJob> weak_factory_; | 76 base::WeakPtrFactory<FileSystemURLRequestJob> weak_factory_; |
| 69 scoped_ptr<net::FileStream> stream_; | 77 scoped_ptr<net::FileStream> stream_; |
| 78 scoped_refptr<webkit_blob::ShareableFileReference> snapshot_ref_; | |
| 70 bool is_directory_; | 79 bool is_directory_; |
| 71 scoped_ptr<net::HttpResponseInfo> response_info_; | 80 scoped_ptr<net::HttpResponseInfo> response_info_; |
| 72 int64 remaining_bytes_; | 81 int64 remaining_bytes_; |
| 73 net::HttpByteRange byte_range_; | 82 net::HttpByteRange byte_range_; |
| 74 | 83 |
| 75 DISALLOW_COPY_AND_ASSIGN(FileSystemURLRequestJob); | 84 DISALLOW_COPY_AND_ASSIGN(FileSystemURLRequestJob); |
| 76 }; | 85 }; |
| 77 | 86 |
| 78 } // namespace fileapi | 87 } // namespace fileapi |
| 79 | 88 |
| 80 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_URL_REQUEST_JOB_H_ | 89 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_URL_REQUEST_JOB_H_ |
| OLD | NEW |