| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "content/common/fileapi/webfilewriter_impl.h" | 5 #include "content/common/fileapi/webfilewriter_impl.h" |
| 6 | 6 |
| 7 #include "content/common/child_thread.h" | 7 #include "content/common/child_thread.h" |
| 8 #include "content/common/fileapi/file_system_dispatcher.h" | 8 #include "content/common/fileapi/file_system_dispatcher.h" |
| 9 | 9 |
| 10 namespace content { | 10 namespace content { |
| 11 namespace { | 11 namespace { |
| 12 | 12 |
| 13 inline FileSystemDispatcher* GetFileSystemDispatcher() { | 13 inline FileSystemDispatcher* GetFileSystemDispatcher() { |
| 14 return ChildThread::current()->file_system_dispatcher(); | 14 return ChildThread::current()->file_system_dispatcher(); |
| 15 } | 15 } |
| 16 } | 16 |
| 17 } // namespace |
| 17 | 18 |
| 18 class WebFileWriterImpl::CallbackDispatcher | 19 class WebFileWriterImpl::CallbackDispatcher |
| 19 : public fileapi::FileSystemCallbackDispatcher { | 20 : public fileapi::FileSystemCallbackDispatcher { |
| 20 public: | 21 public: |
| 21 explicit CallbackDispatcher( | 22 explicit CallbackDispatcher( |
| 22 const base::WeakPtr<WebFileWriterImpl>& writer) : writer_(writer) { | 23 const base::WeakPtr<WebFileWriterImpl>& writer) : writer_(writer) { |
| 23 } | 24 } |
| 24 virtual ~CallbackDispatcher() { | 25 virtual ~CallbackDispatcher() { |
| 25 } | 26 } |
| 26 virtual void DidReadMetadata( | 27 virtual void DidReadMetadata( |
| 27 const base::PlatformFileInfo&, | 28 const base::PlatformFileInfo&, |
| 28 const base::FilePath&) OVERRIDE { | 29 const base::FilePath&) OVERRIDE { |
| 29 NOTREACHED(); | 30 NOTREACHED(); |
| 30 } | 31 } |
| 31 virtual void DidCreateSnapshotFile( | 32 virtual void DidCreateSnapshotFile( |
| 32 const base::PlatformFileInfo&, | 33 const base::PlatformFileInfo&, |
| 33 const base::FilePath&) OVERRIDE { | 34 const base::FilePath&) OVERRIDE { |
| 34 NOTREACHED(); | 35 NOTREACHED(); |
| 35 } | 36 } |
| 36 virtual void DidReadDirectory( | 37 virtual void DidReadDirectory( |
| 37 const std::vector<base::FileUtilProxy::Entry>& entries, | 38 const std::vector<fileapi::FileSystemOperation::Entry>& entries, |
| 38 bool has_more) OVERRIDE { | 39 bool has_more) OVERRIDE { |
| 39 NOTREACHED(); | 40 NOTREACHED(); |
| 40 } | 41 } |
| 41 virtual void DidOpenFileSystem(const std::string& name, | 42 virtual void DidOpenFileSystem(const std::string& name, |
| 42 const GURL& root) OVERRIDE { | 43 const GURL& root) OVERRIDE { |
| 43 NOTREACHED(); | 44 NOTREACHED(); |
| 44 } | 45 } |
| 45 virtual void DidSucceed() OVERRIDE { | 46 virtual void DidSucceed() OVERRIDE { |
| 46 if (writer_) | 47 if (writer_) |
| 47 writer_->DidSucceed(); | 48 writer_->DidSucceed(); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 path, blob_url, offset, &request_id_, | 81 path, blob_url, offset, &request_id_, |
| 81 new CallbackDispatcher(AsWeakPtr())); | 82 new CallbackDispatcher(AsWeakPtr())); |
| 82 } | 83 } |
| 83 | 84 |
| 84 void WebFileWriterImpl::DoCancel() { | 85 void WebFileWriterImpl::DoCancel() { |
| 85 GetFileSystemDispatcher()->Cancel(request_id_, | 86 GetFileSystemDispatcher()->Cancel(request_id_, |
| 86 new CallbackDispatcher(AsWeakPtr())); | 87 new CallbackDispatcher(AsWeakPtr())); |
| 87 } | 88 } |
| 88 | 89 |
| 89 } // namespace content | 90 } // namespace content |
| OLD | NEW |