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_BROWSER_FILEAPI_FILE_SYSTEM_URL_REQUEST_JOB_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_URL_REQUEST_JOB_H_ |
6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_URL_REQUEST_JOB_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_URL_REQUEST_JOB_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 namespace fileapi { | 29 namespace fileapi { |
30 class FileSystemContext; | 30 class FileSystemContext; |
31 | 31 |
32 // A request job that handles reading filesystem: URLs | 32 // A request job that handles reading filesystem: URLs |
33 class WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE FileSystemURLRequestJob | 33 class WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE FileSystemURLRequestJob |
34 : public net::URLRequestJob { | 34 : public net::URLRequestJob { |
35 public: | 35 public: |
36 FileSystemURLRequestJob( | 36 FileSystemURLRequestJob( |
37 net::URLRequest* request, | 37 net::URLRequest* request, |
38 net::NetworkDelegate* network_delegate, | 38 net::NetworkDelegate* network_delegate, |
| 39 const std::string& storage_domain, |
39 FileSystemContext* file_system_context); | 40 FileSystemContext* file_system_context); |
40 | 41 |
41 // URLRequestJob methods: | 42 // URLRequestJob methods: |
42 virtual void Start() OVERRIDE; | 43 virtual void Start() OVERRIDE; |
43 virtual void Kill() OVERRIDE; | 44 virtual void Kill() OVERRIDE; |
44 virtual bool ReadRawData(net::IOBuffer* buf, | 45 virtual bool ReadRawData(net::IOBuffer* buf, |
45 int buf_size, | 46 int buf_size, |
46 int* bytes_read) OVERRIDE; | 47 int* bytes_read) OVERRIDE; |
47 virtual bool IsRedirectResponse(GURL* location, | 48 virtual bool IsRedirectResponse(GURL* location, |
48 int* http_status_code) OVERRIDE; | 49 int* http_status_code) OVERRIDE; |
49 virtual void SetExtraRequestHeaders( | 50 virtual void SetExtraRequestHeaders( |
50 const net::HttpRequestHeaders& headers) OVERRIDE; | 51 const net::HttpRequestHeaders& headers) OVERRIDE; |
51 virtual void GetResponseInfo(net::HttpResponseInfo* info) OVERRIDE; | 52 virtual void GetResponseInfo(net::HttpResponseInfo* info) OVERRIDE; |
52 virtual int GetResponseCode() const OVERRIDE; | 53 virtual int GetResponseCode() const OVERRIDE; |
53 | 54 |
54 // FilterContext methods (via URLRequestJob): | 55 // FilterContext methods (via URLRequestJob): |
55 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; | 56 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; |
56 | 57 |
57 private: | 58 private: |
58 class CallbackDispatcher; | 59 class CallbackDispatcher; |
59 | 60 |
60 virtual ~FileSystemURLRequestJob(); | 61 virtual ~FileSystemURLRequestJob(); |
61 | 62 |
62 void StartAsync(); | 63 void StartAsync(); |
63 void DidGetMetadata( | 64 void DidAttemptAutoMount(base::File::Error result); |
64 base::File::Error error_code, | 65 void DidGetMetadata(base::File::Error error_code, |
65 const base::File::Info& file_info); | 66 const base::File::Info& file_info); |
66 void DidRead(int result); | 67 void DidRead(int result); |
67 void NotifyFailed(int rv); | 68 void NotifyFailed(int rv); |
68 | 69 |
| 70 const std::string storage_domain_; |
69 FileSystemContext* file_system_context_; | 71 FileSystemContext* file_system_context_; |
70 scoped_ptr<webkit_blob::FileStreamReader> reader_; | 72 scoped_ptr<webkit_blob::FileStreamReader> reader_; |
71 FileSystemURL url_; | 73 FileSystemURL url_; |
72 bool is_directory_; | 74 bool is_directory_; |
73 scoped_ptr<net::HttpResponseInfo> response_info_; | 75 scoped_ptr<net::HttpResponseInfo> response_info_; |
74 int64 remaining_bytes_; | 76 int64 remaining_bytes_; |
75 net::HttpByteRange byte_range_; | 77 net::HttpByteRange byte_range_; |
76 base::WeakPtrFactory<FileSystemURLRequestJob> weak_factory_; | 78 base::WeakPtrFactory<FileSystemURLRequestJob> weak_factory_; |
77 | 79 |
78 DISALLOW_COPY_AND_ASSIGN(FileSystemURLRequestJob); | 80 DISALLOW_COPY_AND_ASSIGN(FileSystemURLRequestJob); |
79 }; | 81 }; |
80 | 82 |
81 } // namespace fileapi | 83 } // namespace fileapi |
82 | 84 |
83 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_URL_REQUEST_JOB_H_ | 85 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_URL_REQUEST_JOB_H_ |
OLD | NEW |