| 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 "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/message_loop/message_loop_proxy.h" |
| 10 #include "webkit/renderer/fileapi/webfilewriter_base.h" | 11 #include "webkit/renderer/fileapi/webfilewriter_base.h" |
| 11 | 12 |
| 12 namespace content { | 13 namespace content { |
| 13 | 14 |
| 14 // An implementation of WebFileWriter for use in chrome renderers and workers. | 15 // An implementation of WebFileWriter for use in chrome renderers and workers. |
| 15 class WebFileWriterImpl : public fileapi::WebFileWriterBase, | 16 class WebFileWriterImpl : public fileapi::WebFileWriterBase, |
| 16 public base::SupportsWeakPtr<WebFileWriterImpl> { | 17 public base::SupportsWeakPtr<WebFileWriterImpl> { |
| 17 public: | 18 public: |
| 18 WebFileWriterImpl(const GURL& path, WebKit::WebFileWriterClient* client); | 19 WebFileWriterImpl(const GURL& path, |
| 20 WebKit::WebFileWriterClient* client, |
| 21 base::MessageLoopProxy* main_thread_loop); |
| 19 virtual ~WebFileWriterImpl(); | 22 virtual ~WebFileWriterImpl(); |
| 20 | 23 |
| 21 protected: | 24 protected: |
| 22 // WebFileWriterBase overrides | 25 // WebFileWriterBase overrides |
| 23 virtual void DoTruncate(const GURL& path, int64 offset) OVERRIDE; | 26 virtual void DoTruncate(const GURL& path, int64 offset) OVERRIDE; |
| 24 virtual void DoWrite(const GURL& path, const GURL& blob_url, | 27 virtual void DoWrite(const GURL& path, const GURL& blob_url, |
| 25 int64 offset) OVERRIDE; | 28 int64 offset) OVERRIDE; |
| 26 virtual void DoCancel() OVERRIDE; | 29 virtual void DoCancel() OVERRIDE; |
| 27 | 30 |
| 28 private: | 31 private: |
| 29 class CallbackDispatcher; | 32 class WriterBridge; |
| 30 int request_id_; | 33 |
| 34 void RunOnMainThread(const base::Closure& closure); |
| 35 |
| 36 scoped_refptr<base::MessageLoopProxy> main_thread_loop_; |
| 37 scoped_refptr<WriterBridge> bridge_; |
| 31 }; | 38 }; |
| 32 | 39 |
| 33 } // namespace content | 40 } // namespace content |
| 34 | 41 |
| 35 #endif // CONTENT_CHILD_FILEAPI_WEBFILEWRITER_IMPL_H_ | 42 #endif // CONTENT_CHILD_FILEAPI_WEBFILEWRITER_IMPL_H_ |
| OLD | NEW |