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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/strings/string_piece.h" | 12 #include "base/strings/string_piece.h" |
13 #include "net/base/completion_callback.h" | 13 #include "net/base/completion_callback.h" |
14 #include "net/base/net_export.h" | 14 #include "net/base/net_export.h" |
15 #include "net/url_request/url_range_request_job.h" | 15 #include "net/url_request/url_range_request_job.h" |
16 | 16 |
17 namespace base { | 17 namespace base { |
18 class RefCountedMemory; | 18 class RefCountedMemory; |
19 } | 19 } |
20 | 20 |
21 namespace net { | 21 namespace net { |
22 | 22 |
23 class URLRequest; | 23 class URLRequest; |
24 | 24 |
25 class NET_EXPORT URLRequestSimpleJob : public URLRangeRequestJob { | 25 class NET_EXPORT URLRequestSimpleJob : public URLRangeRequestJob { |
26 public: | 26 public: |
27 URLRequestSimpleJob(URLRequest* request, NetworkDelegate* network_delegate); | 27 URLRequestSimpleJob(URLRequest* request, NetworkDelegate* network_delegate); |
28 | 28 |
29 void Start() override; | 29 void Start() override; |
30 void Kill() override; | |
31 bool ReadRawData(IOBuffer* buf, int buf_size, int* bytes_read) override; | 30 bool ReadRawData(IOBuffer* buf, int buf_size, int* bytes_read) override; |
32 bool GetMimeType(std::string* mime_type) const override; | 31 bool GetMimeType(std::string* mime_type) const override; |
33 bool GetCharset(std::string* charset) override; | 32 bool GetCharset(std::string* charset) override; |
34 | 33 |
35 protected: | 34 protected: |
36 ~URLRequestSimpleJob() override; | 35 ~URLRequestSimpleJob() override; |
37 | 36 |
38 // Subclasses must override either GetData or GetRefCountedData to define the | 37 // Subclasses must override either GetData or GetRefCountedData to define the |
39 // way response data is determined. | 38 // way response data is determined. |
40 // The return value should be: | 39 // The return value should be: |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 std::string charset_; | 72 std::string charset_; |
74 scoped_refptr<base::RefCountedMemory> data_; | 73 scoped_refptr<base::RefCountedMemory> data_; |
75 int64 next_data_offset_; | 74 int64 next_data_offset_; |
76 scoped_refptr<base::TaskRunner> task_runner_; | 75 scoped_refptr<base::TaskRunner> task_runner_; |
77 base::WeakPtrFactory<URLRequestSimpleJob> weak_factory_; | 76 base::WeakPtrFactory<URLRequestSimpleJob> weak_factory_; |
78 }; | 77 }; |
79 | 78 |
80 } // namespace net | 79 } // namespace net |
81 | 80 |
82 #endif // NET_URL_REQUEST_URL_REQUEST_SIMPLE_JOB_H_ | 81 #endif // NET_URL_REQUEST_URL_REQUEST_SIMPLE_JOB_H_ |
OLD | NEW |