| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/task.h" | 11 #include "base/task.h" |
| 12 #include "net/base/net_export.h" | 12 #include "net/base/net_export.h" |
| 13 #include "net/url_request/url_request_job.h" | 13 #include "net/url_request/url_request_job.h" |
| 14 | 14 |
| 15 namespace net { | 15 namespace net { |
| 16 | 16 |
| 17 class URLRequest; | 17 class URLRequest; |
| 18 | 18 |
| 19 class NET_EXPORT URLRequestSimpleJob : public URLRequestJob { | 19 class NET_EXPORT URLRequestSimpleJob : public URLRequestJob { |
| 20 public: | 20 public: |
| 21 explicit URLRequestSimpleJob(URLRequest* request); | 21 explicit URLRequestSimpleJob(URLRequest* request); |
| 22 | 22 |
| 23 virtual void Start(); | 23 virtual void Start() OVERRIDE; |
| 24 virtual bool ReadRawData(IOBuffer* buf, int buf_size, int *bytes_read); | 24 virtual bool ReadRawData(IOBuffer* buf, |
| 25 virtual bool GetMimeType(std::string* mime_type) const; | 25 int buf_size, |
| 26 virtual bool GetCharset(std::string* charset); | 26 int *bytes_read) OVERRIDE; |
| 27 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; |
| 28 virtual bool GetCharset(std::string* charset) OVERRIDE; |
| 27 | 29 |
| 28 protected: | 30 protected: |
| 29 virtual ~URLRequestSimpleJob(); | 31 virtual ~URLRequestSimpleJob(); |
| 30 | 32 |
| 31 // subclasses must override the way response data is determined. | 33 // subclasses must override the way response data is determined. |
| 32 virtual bool GetData(std::string* mime_type, | 34 virtual bool GetData(std::string* mime_type, |
| 33 std::string* charset, | 35 std::string* charset, |
| 34 std::string* data) const = 0; | 36 std::string* data) const = 0; |
| 35 | 37 |
| 36 protected: | 38 protected: |
| 37 void StartAsync(); | 39 void StartAsync(); |
| 38 | 40 |
| 39 private: | 41 private: |
| 40 std::string mime_type_; | 42 std::string mime_type_; |
| 41 std::string charset_; | 43 std::string charset_; |
| 42 std::string data_; | 44 std::string data_; |
| 43 int data_offset_; | 45 int data_offset_; |
| 44 ScopedRunnableMethodFactory<URLRequestSimpleJob> method_factory_; | 46 ScopedRunnableMethodFactory<URLRequestSimpleJob> method_factory_; |
| 45 }; | 47 }; |
| 46 | 48 |
| 47 } // namespace net | 49 } // namespace net |
| 48 | 50 |
| 49 #endif // NET_URL_REQUEST_URL_REQUEST_SIMPLE_JOB_H_ | 51 #endif // NET_URL_REQUEST_URL_REQUEST_SIMPLE_JOB_H_ |
| OLD | NEW |