| 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_BLOB_BLOB_URL_REQUEST_JOB_H_ | 5 #ifndef STORAGE_BROWSER_BLOB_BLOB_URL_REQUEST_JOB_H_ |
| 6 #define STORAGE_BROWSER_BLOB_BLOB_URL_REQUEST_JOB_H_ | 6 #define STORAGE_BROWSER_BLOB_BLOB_URL_REQUEST_JOB_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // Helper method to create the HTTP headers for the response. | 55 // Helper method to create the HTTP headers for the response. |
| 56 // |blob_handles|, |blob_reader|, |byte_range| and |content_size| are only | 56 // |blob_handles|, |blob_reader|, |byte_range| and |content_size| are only |
| 57 // used if status_code isn't an error. | 57 // used if status_code isn't an error. |
| 58 static scoped_refptr<net::HttpResponseHeaders> GenerateHeaders( | 58 static scoped_refptr<net::HttpResponseHeaders> GenerateHeaders( |
| 59 net::HttpStatusCode status_code, | 59 net::HttpStatusCode status_code, |
| 60 BlobDataHandle* blob_handle, | 60 BlobDataHandle* blob_handle, |
| 61 BlobReader* blob_reader, | 61 BlobReader* blob_reader, |
| 62 net::HttpByteRange* byte_range, | 62 net::HttpByteRange* byte_range, |
| 63 int64_t* content_size); | 63 int64_t* content_size); |
| 64 | 64 |
| 65 // Helper method to map from a net error to an http status code. | |
| 66 static net::HttpStatusCode NetErrorToHttpStatusCode(int error_code); | |
| 67 | |
| 68 protected: | 65 protected: |
| 69 ~BlobURLRequestJob() override; | 66 ~BlobURLRequestJob() override; |
| 70 | 67 |
| 71 private: | 68 private: |
| 72 typedef std::map<size_t, FileStreamReader*> IndexToReaderMap; | 69 typedef std::map<size_t, FileStreamReader*> IndexToReaderMap; |
| 73 | 70 |
| 74 // For preparing for read: get the size, apply the range and perform seek. | 71 // For preparing for read: get the size, apply the range and perform seek. |
| 75 void DidStart(); | 72 void DidStart(); |
| 76 void DidCalculateSize(int result); | 73 void DidCalculateSize(int result); |
| 77 void DidReadMetadata(BlobReader::Status result); | 74 void DidReadMetadata(BlobReader::Status result); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 91 std::unique_ptr<net::HttpResponseInfo> response_info_; | 88 std::unique_ptr<net::HttpResponseInfo> response_info_; |
| 92 | 89 |
| 93 base::WeakPtrFactory<BlobURLRequestJob> weak_factory_; | 90 base::WeakPtrFactory<BlobURLRequestJob> weak_factory_; |
| 94 | 91 |
| 95 DISALLOW_COPY_AND_ASSIGN(BlobURLRequestJob); | 92 DISALLOW_COPY_AND_ASSIGN(BlobURLRequestJob); |
| 96 }; | 93 }; |
| 97 | 94 |
| 98 } // namespace storage | 95 } // namespace storage |
| 99 | 96 |
| 100 #endif // STORAGE_BROWSER_BLOB_BLOB_URL_REQUEST_JOB_H_ | 97 #endif // STORAGE_BROWSER_BLOB_BLOB_URL_REQUEST_JOB_H_ |
| OLD | NEW |