#ifndef WEBKIT_TOOLS_TEST_SHELL_SIMPLE_FILE_WRITER_H_
#define WEBKIT_TOOLS_TEST_SHELL_SIMPLE_FILE_WRITER_H_
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "webkit/fileapi/webfilewriter_base.h"
namespace net {
class URLRequestContext;
}
namespace fileapi {
class FileSystemContext;
}
class SimpleFileWriter : public fileapi::WebFileWriterBase,
public base::SupportsWeakPtr<SimpleFileWriter> {
public:
SimpleFileWriter(
const GURL& path,
WebKit::WebFileWriterClient* client,
fileapi::FileSystemContext* file_system_context);
virtual ~SimpleFileWriter();
static void InitializeOnIOThread(net::URLRequestContext* request_context) {
request_context_ = request_context;
}
static void CleanupOnIOThread() {
request_context_ = NULL;
}
protected:
virtual void DoTruncate(const GURL& path, int64 offset) OVERRIDE;
virtual void DoWrite(const GURL& path, const GURL& blob_url,
int64 offset) OVERRIDE;
virtual void DoCancel() OVERRIDE;
private:
class IOThreadProxy;
scoped_refptr<IOThreadProxy> io_thread_proxy_;
static net::URLRequestContext* request_context_;
};
#endif