OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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> |
| 9 |
8 #include "net/url_request/url_request_job.h" | 10 #include "net/url_request/url_request_job.h" |
9 | 11 |
10 class URLRequest; | 12 class URLRequest; |
11 | 13 |
12 class URLRequestSimpleJob : public URLRequestJob { | 14 class URLRequestSimpleJob : public URLRequestJob { |
13 public: | 15 public: |
14 URLRequestSimpleJob(URLRequest* request); | 16 explicit URLRequestSimpleJob(URLRequest* request); |
15 | 17 |
16 virtual void Start(); | 18 virtual void Start(); |
17 virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int *bytes_read); | 19 virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int *bytes_read); |
18 virtual bool GetMimeType(std::string* mime_type); | 20 virtual bool GetMimeType(std::string* mime_type) const; |
19 virtual bool GetCharset(std::string* charset); | 21 virtual bool GetCharset(std::string* charset); |
20 | 22 |
21 protected: | 23 protected: |
22 // subclasses must override the way response data is determined. | 24 // subclasses must override the way response data is determined. |
23 virtual bool GetData(std::string* mime_type, | 25 virtual bool GetData(std::string* mime_type, |
24 std::string* charset, | 26 std::string* charset, |
25 std::string* data) const = 0; | 27 std::string* data) const = 0; |
26 | 28 |
27 private: | 29 private: |
28 void StartAsync(); | 30 void StartAsync(); |
29 | 31 |
30 std::string mime_type_; | 32 std::string mime_type_; |
31 std::string charset_; | 33 std::string charset_; |
32 std::string data_; | 34 std::string data_; |
33 int data_offset_; | 35 int data_offset_; |
34 }; | 36 }; |
35 | 37 |
36 #endif // NET_URL_REQUEST_URL_REQUEST_DATA_JOB_H_ | 38 #endif // NET_URL_REQUEST_URL_REQUEST_DATA_JOB_H_ |
OLD | NEW |