#ifndef CONTENT_CHILD_FILEAPI_WEBFILEWRITER_IMPL_H_
#define CONTENT_CHILD_FILEAPI_WEBFILEWRITER_IMPL_H_
#include <string>
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/message_loop/message_loop_proxy.h"
#include "content/child/fileapi/webfilewriter_base.h"
namespace content {
class WebFileWriterImpl : public WebFileWriterBase,
public base::SupportsWeakPtr<WebFileWriterImpl> {
public:
enum Type {
TYPE_SYNC,
TYPE_ASYNC,
};
WebFileWriterImpl(const GURL& path,
blink::WebFileWriterClient* client,
Type type,
base::MessageLoopProxy* main_thread_loop);
virtual ~WebFileWriterImpl();
protected:
virtual void DoTruncate(const GURL& path, int64 offset) OVERRIDE;
virtual void DoWrite(const GURL& path, const std::string& blob_id,
int64 offset) OVERRIDE;
virtual void DoCancel() OVERRIDE;
private:
class WriterBridge;
void RunOnMainThread(const base::Closure& closure);
scoped_refptr<base::MessageLoopProxy> main_thread_loop_;
scoped_refptr<WriterBridge> bridge_;
};
}
#endif