OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 CONTENT_CHILD_FILEAPI_WEBFILEWRITER_IMPL_H_ | 5 #ifndef CONTENT_CHILD_FILEAPI_WEBFILEWRITER_IMPL_H_ |
6 #define CONTENT_CHILD_FILEAPI_WEBFILEWRITER_IMPL_H_ | 6 #define CONTENT_CHILD_FILEAPI_WEBFILEWRITER_IMPL_H_ |
7 | 7 |
| 8 #include <string> |
| 9 |
8 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
9 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
10 #include "base/message_loop/message_loop_proxy.h" | 12 #include "base/message_loop/message_loop_proxy.h" |
11 #include "content/child/fileapi/webfilewriter_base.h" | 13 #include "content/child/fileapi/webfilewriter_base.h" |
12 | 14 |
13 namespace content { | 15 namespace content { |
14 | 16 |
15 // An implementation of WebFileWriter for use in chrome renderers and workers. | 17 // An implementation of WebFileWriter for use in chrome renderers and workers. |
16 class WebFileWriterImpl : public WebFileWriterBase, | 18 class WebFileWriterImpl : public WebFileWriterBase, |
17 public base::SupportsWeakPtr<WebFileWriterImpl> { | 19 public base::SupportsWeakPtr<WebFileWriterImpl> { |
18 public: | 20 public: |
19 enum Type { | 21 enum Type { |
20 TYPE_SYNC, | 22 TYPE_SYNC, |
21 TYPE_ASYNC, | 23 TYPE_ASYNC, |
22 }; | 24 }; |
23 | 25 |
24 WebFileWriterImpl(const GURL& path, | 26 WebFileWriterImpl(const GURL& path, |
25 WebKit::WebFileWriterClient* client, | 27 WebKit::WebFileWriterClient* client, |
26 Type type, | 28 Type type, |
27 base::MessageLoopProxy* main_thread_loop); | 29 base::MessageLoopProxy* main_thread_loop); |
28 virtual ~WebFileWriterImpl(); | 30 virtual ~WebFileWriterImpl(); |
29 | 31 |
30 protected: | 32 protected: |
31 // WebFileWriterBase overrides | 33 // WebFileWriterBase overrides |
32 virtual void DoTruncate(const GURL& path, int64 offset) OVERRIDE; | 34 virtual void DoTruncate(const GURL& path, int64 offset) OVERRIDE; |
33 virtual void DoWrite(const GURL& path, const GURL& blob_url, | 35 virtual void DoWriteDeprecated( |
| 36 const GURL& path, const GURL& blob_url, int64 offset) OVERRIDE; |
| 37 virtual void DoWrite(const GURL& path, const std::string& blob_id, |
34 int64 offset) OVERRIDE; | 38 int64 offset) OVERRIDE; |
35 virtual void DoCancel() OVERRIDE; | 39 virtual void DoCancel() OVERRIDE; |
36 | 40 |
37 private: | 41 private: |
38 class WriterBridge; | 42 class WriterBridge; |
39 | 43 |
40 void RunOnMainThread(const base::Closure& closure); | 44 void RunOnMainThread(const base::Closure& closure); |
41 | 45 |
42 scoped_refptr<base::MessageLoopProxy> main_thread_loop_; | 46 scoped_refptr<base::MessageLoopProxy> main_thread_loop_; |
43 scoped_refptr<WriterBridge> bridge_; | 47 scoped_refptr<WriterBridge> bridge_; |
44 }; | 48 }; |
45 | 49 |
46 } // namespace content | 50 } // namespace content |
47 | 51 |
48 #endif // CONTENT_CHILD_FILEAPI_WEBFILEWRITER_IMPL_H_ | 52 #endif // CONTENT_CHILD_FILEAPI_WEBFILEWRITER_IMPL_H_ |
OLD | NEW |