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 STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_URL_REQUEST_JOB_H_ | 5 #ifndef STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_URL_REQUEST_JOB_H_ |
6 #define STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_URL_REQUEST_JOB_H_ | 6 #define STORAGE_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" |
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 "net/base/net_errors.h" | |
15 #include "net/http/http_byte_range.h" | 14 #include "net/http/http_byte_range.h" |
16 #include "net/url_request/url_request_job.h" | 15 #include "net/url_request/url_request_job.h" |
17 #include "storage/browser/fileapi/file_system_url.h" | 16 #include "storage/browser/fileapi/file_system_url.h" |
18 #include "storage/browser/storage_browser_export.h" | 17 #include "storage/browser/storage_browser_export.h" |
19 | 18 |
20 class GURL; | 19 class GURL; |
21 | 20 |
22 namespace base { | 21 namespace base { |
23 class FilePath; | 22 class FilePath; |
24 } | 23 } |
(...skipping 10 matching lines...) Expand all Loading... |
35 public: | 34 public: |
36 FileSystemURLRequestJob( | 35 FileSystemURLRequestJob( |
37 net::URLRequest* request, | 36 net::URLRequest* request, |
38 net::NetworkDelegate* network_delegate, | 37 net::NetworkDelegate* network_delegate, |
39 const std::string& storage_domain, | 38 const std::string& storage_domain, |
40 FileSystemContext* file_system_context); | 39 FileSystemContext* file_system_context); |
41 | 40 |
42 // URLRequestJob methods: | 41 // URLRequestJob methods: |
43 void Start() override; | 42 void Start() override; |
44 void Kill() override; | 43 void Kill() override; |
45 int ReadRawData(net::IOBuffer* buf, int buf_size) override; | 44 bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read) override; |
46 bool IsRedirectResponse(GURL* location, int* http_status_code) override; | 45 bool IsRedirectResponse(GURL* location, int* http_status_code) override; |
47 void SetExtraRequestHeaders(const net::HttpRequestHeaders& headers) override; | 46 void SetExtraRequestHeaders(const net::HttpRequestHeaders& headers) override; |
48 void GetResponseInfo(net::HttpResponseInfo* info) override; | 47 void GetResponseInfo(net::HttpResponseInfo* info) override; |
49 int GetResponseCode() const override; | 48 int GetResponseCode() const override; |
50 | 49 |
51 // FilterContext methods (via URLRequestJob): | 50 // FilterContext methods (via URLRequestJob): |
52 bool GetMimeType(std::string* mime_type) const override; | 51 bool GetMimeType(std::string* mime_type) const override; |
53 | 52 |
54 private: | 53 private: |
55 class CallbackDispatcher; | 54 class CallbackDispatcher; |
56 | 55 |
57 ~FileSystemURLRequestJob() override; | 56 ~FileSystemURLRequestJob() override; |
58 | 57 |
59 void StartAsync(); | 58 void StartAsync(); |
60 void DidAttemptAutoMount(base::File::Error result); | 59 void DidAttemptAutoMount(base::File::Error result); |
61 void DidGetMetadata(base::File::Error error_code, | 60 void DidGetMetadata(base::File::Error error_code, |
62 const base::File::Info& file_info); | 61 const base::File::Info& file_info); |
63 void DidRead(int result); | 62 void DidRead(int result); |
| 63 void NotifyFailed(int rv); |
64 | 64 |
65 const std::string storage_domain_; | 65 const std::string storage_domain_; |
66 FileSystemContext* file_system_context_; | 66 FileSystemContext* file_system_context_; |
67 scoped_ptr<storage::FileStreamReader> reader_; | 67 scoped_ptr<storage::FileStreamReader> reader_; |
68 FileSystemURL url_; | 68 FileSystemURL url_; |
69 bool is_directory_; | 69 bool is_directory_; |
70 scoped_ptr<net::HttpResponseInfo> response_info_; | 70 scoped_ptr<net::HttpResponseInfo> response_info_; |
71 int64 remaining_bytes_; | 71 int64 remaining_bytes_; |
72 net::Error range_parse_result_; | |
73 net::HttpByteRange byte_range_; | 72 net::HttpByteRange byte_range_; |
74 base::WeakPtrFactory<FileSystemURLRequestJob> weak_factory_; | 73 base::WeakPtrFactory<FileSystemURLRequestJob> weak_factory_; |
75 | 74 |
76 DISALLOW_COPY_AND_ASSIGN(FileSystemURLRequestJob); | 75 DISALLOW_COPY_AND_ASSIGN(FileSystemURLRequestJob); |
77 }; | 76 }; |
78 | 77 |
79 } // namespace storage | 78 } // namespace storage |
80 | 79 |
81 #endif // STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_URL_REQUEST_JOB_H_ | 80 #endif // STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_URL_REQUEST_JOB_H_ |
OLD | NEW |