| 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" | |
| 15 #include "base/platform_file.h" | 14 #include "base/platform_file.h" |
| 16 #include "net/http/http_byte_range.h" | 15 #include "net/http/http_byte_range.h" |
| 17 #include "net/url_request/url_request_job.h" | 16 #include "net/url_request/url_request_job.h" |
| 18 | 17 |
| 19 class GURL; | 18 class GURL; |
| 20 class FilePath; | 19 class FilePath; |
| 21 | 20 |
| 22 namespace webkit_blob { | 21 namespace webkit_blob { |
| 23 class FileReader; | 22 class FileReader; |
| 24 } | 23 } |
| 25 | 24 |
| 26 namespace fileapi { | 25 namespace fileapi { |
| 27 class FileSystemContext; | 26 class FileSystemContext; |
| 28 | 27 |
| 29 // A request job that handles reading filesystem: URLs | 28 // A request job that handles reading filesystem: URLs |
| 30 class FileSystemURLRequestJob : public net::URLRequestJob { | 29 class FileSystemURLRequestJob : public net::URLRequestJob { |
| 31 public: | 30 public: |
| 32 FileSystemURLRequestJob( | 31 FileSystemURLRequestJob( |
| 33 net::URLRequest* request, | 32 net::URLRequest* request, |
| 34 FileSystemContext* file_system_context, | 33 FileSystemContext* file_system_context); |
| 35 scoped_refptr<base::MessageLoopProxy> file_thread_proxy); | |
| 36 | 34 |
| 37 // URLRequestJob methods: | 35 // URLRequestJob methods: |
| 38 virtual void Start() OVERRIDE; | 36 virtual void Start() OVERRIDE; |
| 39 virtual void Kill() OVERRIDE; | 37 virtual void Kill() OVERRIDE; |
| 40 virtual bool ReadRawData(net::IOBuffer* buf, | 38 virtual bool ReadRawData(net::IOBuffer* buf, |
| 41 int buf_size, | 39 int buf_size, |
| 42 int* bytes_read) OVERRIDE; | 40 int* bytes_read) OVERRIDE; |
| 43 virtual bool IsRedirectResponse(GURL* location, | 41 virtual bool IsRedirectResponse(GURL* location, |
| 44 int* http_status_code) OVERRIDE; | 42 int* http_status_code) OVERRIDE; |
| 45 virtual void SetExtraRequestHeaders( | 43 virtual void SetExtraRequestHeaders( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 57 | 55 |
| 58 void StartAsync(); | 56 void StartAsync(); |
| 59 void DidGetMetadata( | 57 void DidGetMetadata( |
| 60 base::PlatformFileError error_code, | 58 base::PlatformFileError error_code, |
| 61 const base::PlatformFileInfo& file_info, | 59 const base::PlatformFileInfo& file_info, |
| 62 const FilePath& platform_path); | 60 const FilePath& platform_path); |
| 63 void DidRead(int result); | 61 void DidRead(int result); |
| 64 void NotifyFailed(int rv); | 62 void NotifyFailed(int rv); |
| 65 | 63 |
| 66 FileSystemContext* file_system_context_; | 64 FileSystemContext* file_system_context_; |
| 67 scoped_refptr<base::MessageLoopProxy> file_thread_proxy_; | |
| 68 base::WeakPtrFactory<FileSystemURLRequestJob> weak_factory_; | 65 base::WeakPtrFactory<FileSystemURLRequestJob> weak_factory_; |
| 69 scoped_ptr<webkit_blob::FileReader> reader_; | 66 scoped_ptr<webkit_blob::FileReader> reader_; |
| 70 bool is_directory_; | 67 bool is_directory_; |
| 71 scoped_ptr<net::HttpResponseInfo> response_info_; | 68 scoped_ptr<net::HttpResponseInfo> response_info_; |
| 72 int64 remaining_bytes_; | 69 int64 remaining_bytes_; |
| 73 net::HttpByteRange byte_range_; | 70 net::HttpByteRange byte_range_; |
| 74 | 71 |
| 75 DISALLOW_COPY_AND_ASSIGN(FileSystemURLRequestJob); | 72 DISALLOW_COPY_AND_ASSIGN(FileSystemURLRequestJob); |
| 76 }; | 73 }; |
| 77 | 74 |
| 78 } // namespace fileapi | 75 } // namespace fileapi |
| 79 | 76 |
| 80 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_URL_REQUEST_JOB_H_ | 77 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_URL_REQUEST_JOB_H_ |
| OLD | NEW |