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 10 matching lines...) Expand all Loading... |
34 public: | 35 public: |
35 FileSystemURLRequestJob( | 36 FileSystemURLRequestJob( |
36 net::URLRequest* request, | 37 net::URLRequest* request, |
37 net::NetworkDelegate* network_delegate, | 38 net::NetworkDelegate* network_delegate, |
38 const std::string& storage_domain, | 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 void Start() override; | 43 void Start() override; |
43 void Kill() override; | 44 void Kill() override; |
44 bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read) override; | 45 int ReadRawData(net::IOBuffer* buf, int buf_size) override; |
45 bool IsRedirectResponse(GURL* location, int* http_status_code) override; | 46 bool IsRedirectResponse(GURL* location, int* http_status_code) override; |
46 void SetExtraRequestHeaders(const net::HttpRequestHeaders& headers) override; | 47 void SetExtraRequestHeaders(const net::HttpRequestHeaders& headers) override; |
47 void GetResponseInfo(net::HttpResponseInfo* info) override; | 48 void GetResponseInfo(net::HttpResponseInfo* info) override; |
48 int GetResponseCode() const override; | 49 int GetResponseCode() const override; |
49 | 50 |
50 // FilterContext methods (via URLRequestJob): | 51 // FilterContext methods (via URLRequestJob): |
51 bool GetMimeType(std::string* mime_type) const override; | 52 bool GetMimeType(std::string* mime_type) const override; |
52 | 53 |
53 private: | 54 private: |
54 class CallbackDispatcher; | 55 class CallbackDispatcher; |
55 | 56 |
56 ~FileSystemURLRequestJob() override; | 57 ~FileSystemURLRequestJob() override; |
57 | 58 |
58 void StartAsync(); | 59 void StartAsync(); |
59 void DidAttemptAutoMount(base::File::Error result); | 60 void DidAttemptAutoMount(base::File::Error result); |
60 void DidGetMetadata(base::File::Error error_code, | 61 void DidGetMetadata(base::File::Error error_code, |
61 const base::File::Info& file_info); | 62 const base::File::Info& file_info); |
62 void DidRead(int result); | 63 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_; |
72 net::HttpByteRange byte_range_; | 73 net::HttpByteRange byte_range_; |
73 base::WeakPtrFactory<FileSystemURLRequestJob> weak_factory_; | 74 base::WeakPtrFactory<FileSystemURLRequestJob> weak_factory_; |
74 | 75 |
75 DISALLOW_COPY_AND_ASSIGN(FileSystemURLRequestJob); | 76 DISALLOW_COPY_AND_ASSIGN(FileSystemURLRequestJob); |
76 }; | 77 }; |
77 | 78 |
78 } // namespace storage | 79 } // namespace storage |
79 | 80 |
80 #endif // STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_URL_REQUEST_JOB_H_ | 81 #endif // STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_URL_REQUEST_JOB_H_ |
OLD | NEW |