#ifndef NET_URL_REQUEST_URL_REQUEST_SIMPLE_JOB_H_
#define NET_URL_REQUEST_URL_REQUEST_SIMPLE_JOB_H_
#include <string>
#include "base/memory/weak_ptr.h"
#include "net/base/completion_callback.h"
#include "net/base/net_export.h"
#include "net/url_request/url_range_request_job.h"
namespace net {
class URLRequest;
class NET_EXPORT URLRequestSimpleJob : public URLRangeRequestJob {
public:
URLRequestSimpleJob(URLRequest* request, NetworkDelegate* network_delegate);
virtual void Start() OVERRIDE;
virtual bool ReadRawData(IOBuffer* buf,
int buf_size,
int *bytes_read) OVERRIDE;
virtual bool GetMimeType(std::string* mime_type) const OVERRIDE;
virtual bool GetCharset(std::string* charset) OVERRIDE;
protected:
virtual ~URLRequestSimpleJob();
virtual int GetData(std::string* mime_type,
std::string* charset,
std::string* data,
const CompletionCallback& callback) const = 0;
protected:
void StartAsync();
private:
void OnGetDataCompleted(int result);
HttpByteRange byte_range_;
std::string mime_type_;
std::string charset_;
std::string data_;
int data_offset_;
base::WeakPtrFactory<URLRequestSimpleJob> weak_factory_;
};
}
#endif