| 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 NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_ |
| 6 #define NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> |
| 10 #include <string> | 11 #include <string> |
| 11 #include <vector> | 12 #include <vector> |
| 12 | 13 |
| 13 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
| 14 #include "base/macros.h" | 15 #include "base/macros.h" |
| 15 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 17 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
| 18 #include "net/base/net_export.h" | 19 #include "net/base/net_export.h" |
| 19 #include "net/http/http_byte_range.h" | 20 #include "net/http/http_byte_range.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 37 URLRequestFileJob(URLRequest* request, | 38 URLRequestFileJob(URLRequest* request, |
| 38 NetworkDelegate* network_delegate, | 39 NetworkDelegate* network_delegate, |
| 39 const base::FilePath& file_path, | 40 const base::FilePath& file_path, |
| 40 const scoped_refptr<base::TaskRunner>& file_task_runner); | 41 const scoped_refptr<base::TaskRunner>& file_task_runner); |
| 41 | 42 |
| 42 // URLRequestJob: | 43 // URLRequestJob: |
| 43 void Start() override; | 44 void Start() override; |
| 44 void Kill() override; | 45 void Kill() override; |
| 45 int ReadRawData(IOBuffer* buf, int buf_size) override; | 46 int ReadRawData(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 std::unique_ptr<Filter> SetupFilter() const override; | |
| 48 bool GetMimeType(std::string* mime_type) const override; | 48 bool GetMimeType(std::string* mime_type) const override; |
| 49 void SetExtraRequestHeaders(const HttpRequestHeaders& headers) override; | 49 void SetExtraRequestHeaders(const HttpRequestHeaders& headers) override; |
| 50 std::unique_ptr<StreamSource> SetupSource() override; |
| 50 | 51 |
| 51 // An interface for subclasses who wish to monitor read operations. | 52 // An interface for subclasses who wish to monitor read operations. |
| 52 virtual void OnSeekComplete(int64_t result); | 53 virtual void OnSeekComplete(int64_t result); |
| 53 virtual void OnReadComplete(IOBuffer* buf, int result); | 54 virtual void OnReadComplete(IOBuffer* buf, int result); |
| 54 | 55 |
| 55 protected: | 56 protected: |
| 56 ~URLRequestFileJob() override; | 57 ~URLRequestFileJob() override; |
| 57 | 58 |
| 58 int64_t remaining_bytes() const { return remaining_bytes_; } | 59 int64_t remaining_bytes() const { return remaining_bytes_; } |
| 59 | 60 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 Error range_parse_result_; | 109 Error range_parse_result_; |
| 109 | 110 |
| 110 base::WeakPtrFactory<URLRequestFileJob> weak_ptr_factory_; | 111 base::WeakPtrFactory<URLRequestFileJob> weak_ptr_factory_; |
| 111 | 112 |
| 112 DISALLOW_COPY_AND_ASSIGN(URLRequestFileJob); | 113 DISALLOW_COPY_AND_ASSIGN(URLRequestFileJob); |
| 113 }; | 114 }; |
| 114 | 115 |
| 115 } // namespace net | 116 } // namespace net |
| 116 | 117 |
| 117 #endif // NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_ | 118 #endif // NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_ |
| OLD | NEW |