| 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_SIMPLE_JOB_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_SIMPLE_JOB_H_ |
| 6 #define NET_URL_REQUEST_URL_REQUEST_SIMPLE_JOB_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_SIMPLE_JOB_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 std::string* data, | 53 std::string* data, |
| 54 const CompletionCallback& callback) const; | 54 const CompletionCallback& callback) const; |
| 55 | 55 |
| 56 // Similar to GetData(), except |*data| can share ownership of the bytes | 56 // Similar to GetData(), except |*data| can share ownership of the bytes |
| 57 // instead of copying them into a std::string. | 57 // instead of copying them into a std::string. |
| 58 virtual int GetRefCountedData(std::string* mime_type, | 58 virtual int GetRefCountedData(std::string* mime_type, |
| 59 std::string* charset, | 59 std::string* charset, |
| 60 scoped_refptr<base::RefCountedMemory>* data, | 60 scoped_refptr<base::RefCountedMemory>* data, |
| 61 const CompletionCallback& callback) const; | 61 const CompletionCallback& callback) const; |
| 62 | 62 |
| 63 // Returns the task runner used by ReadRawData. This method is virtual so | |
| 64 // that it can be overridden in tests. | |
| 65 virtual base::TaskRunner* GetTaskRunner() const; | |
| 66 | |
| 67 void StartAsync(); | 63 void StartAsync(); |
| 68 | 64 |
| 69 private: | 65 private: |
| 70 void OnGetDataCompleted(int result); | 66 void OnGetDataCompleted(int result); |
| 71 | 67 |
| 72 HttpByteRange byte_range_; | 68 HttpByteRange byte_range_; |
| 73 std::string mime_type_; | 69 std::string mime_type_; |
| 74 std::string charset_; | 70 std::string charset_; |
| 75 scoped_refptr<base::RefCountedMemory> data_; | 71 scoped_refptr<base::RefCountedMemory> data_; |
| 76 int64_t next_data_offset_; | 72 int64_t next_data_offset_; |
| 77 scoped_refptr<base::TaskRunner> task_runner_; | |
| 78 base::WeakPtrFactory<URLRequestSimpleJob> weak_factory_; | 73 base::WeakPtrFactory<URLRequestSimpleJob> weak_factory_; |
| 79 }; | 74 }; |
| 80 | 75 |
| 81 } // namespace net | 76 } // namespace net |
| 82 | 77 |
| 83 #endif // NET_URL_REQUEST_URL_REQUEST_SIMPLE_JOB_H_ | 78 #endif // NET_URL_REQUEST_URL_REQUEST_SIMPLE_JOB_H_ |
| OLD | NEW |