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