Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / content / child / fileapi / webfilewriter_impl.h
blob40ef0a3fbd2862399950aec811a379ebfb4b4237
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_CHILD_FILEAPI_WEBFILEWRITER_IMPL_H_
6 #define CONTENT_CHILD_FILEAPI_WEBFILEWRITER_IMPL_H_
8 #include <string>
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/weak_ptr.h"
12 #include "base/message_loop/message_loop_proxy.h"
13 #include "content/child/fileapi/webfilewriter_base.h"
15 namespace content {
17 // An implementation of WebFileWriter for use in chrome renderers and workers.
18 class WebFileWriterImpl : public WebFileWriterBase,
19 public base::SupportsWeakPtr<WebFileWriterImpl> {
20 public:
21 enum Type {
22 TYPE_SYNC,
23 TYPE_ASYNC,
26 WebFileWriterImpl(const GURL& path,
27 blink::WebFileWriterClient* client,
28 Type type,
29 const scoped_refptr<base::SingleThreadTaskRunner>&
30 main_thread_task_runner);
31 virtual ~WebFileWriterImpl();
33 protected:
34 // WebFileWriterBase overrides
35 void DoTruncate(const GURL& path, int64 offset) override;
36 void DoWrite(const GURL& path,
37 const std::string& blob_id,
38 int64 offset) override;
39 void DoCancel() override;
41 private:
42 class WriterBridge;
44 void RunOnMainThread(const base::Closure& closure);
46 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
47 scoped_refptr<WriterBridge> bridge_;
50 } // namespace content
52 #endif // CONTENT_CHILD_FILEAPI_WEBFILEWRITER_IMPL_H_