OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/common/file_system/webfilewriter_impl.h" | 5 #include "chrome/common/file_system/webfilewriter_impl.h" |
6 | 6 |
7 #include "chrome/common/child_thread.h" | 7 #include "chrome/common/child_thread.h" |
8 #include "chrome/common/file_system/file_system_dispatcher.h" | 8 #include "chrome/common/file_system/file_system_dispatcher.h" |
9 | 9 |
10 namespace { | 10 namespace { |
11 | 11 |
12 inline FileSystemDispatcher* GetFileSystemDispatcher() { | 12 inline FileSystemDispatcher* GetFileSystemDispatcher() { |
13 return ChildThread::current()->file_system_dispatcher(); | 13 return ChildThread::current()->file_system_dispatcher(); |
14 } | 14 } |
15 | |
16 } | 15 } |
17 | 16 |
18 class WebFileWriterImpl::CallbackDispatcher | 17 class WebFileWriterImpl::CallbackDispatcher |
19 : public fileapi::FileSystemCallbackDispatcher { | 18 : public fileapi::FileSystemCallbackDispatcher { |
20 public: | 19 public: |
21 explicit CallbackDispatcher( | 20 explicit CallbackDispatcher( |
22 const base::WeakPtr<WebFileWriterImpl>& writer) : writer_(writer) { | 21 const base::WeakPtr<WebFileWriterImpl>& writer) : writer_(writer) { |
23 } | 22 } |
24 virtual ~CallbackDispatcher() { | 23 virtual ~CallbackDispatcher() { |
25 } | 24 } |
26 | 25 |
27 virtual void DidReadMetadata(const base::PlatformFileInfo&) { | 26 virtual void DidReadMetadata(const base::PlatformFileInfo&) { |
28 NOTREACHED(); | 27 NOTREACHED(); |
29 } | 28 } |
30 virtual void DidReadDirectory( | 29 virtual void DidReadDirectory( |
31 const std::vector<base::file_util_proxy::Entry>& entries, | 30 const std::vector<base::FileUtilProxy::Entry>& entries, |
32 bool has_more) { | 31 bool has_more) { |
33 NOTREACHED(); | 32 NOTREACHED(); |
34 } | 33 } |
35 virtual void DidOpenFileSystem(const std::string& name, | 34 virtual void DidOpenFileSystem(const std::string& name, |
36 const FilePath& root_path) { | 35 const FilePath& root_path) { |
37 NOTREACHED(); | 36 NOTREACHED(); |
38 } | 37 } |
39 virtual void DidSucceed() { | 38 virtual void DidSucceed() { |
40 if (writer_) | 39 if (writer_) |
41 writer_->DidSucceed(); | 40 writer_->DidSucceed(); |
(...skipping 29 matching lines...) Expand all Loading... |
71 void WebFileWriterImpl::DoWrite( | 70 void WebFileWriterImpl::DoWrite( |
72 const FilePath& path, const GURL& blob_url, int64 offset) { | 71 const FilePath& path, const GURL& blob_url, int64 offset) { |
73 GetFileSystemDispatcher()->Write(path, blob_url, offset, &request_id_, | 72 GetFileSystemDispatcher()->Write(path, blob_url, offset, &request_id_, |
74 new CallbackDispatcher(AsWeakPtr())); | 73 new CallbackDispatcher(AsWeakPtr())); |
75 } | 74 } |
76 | 75 |
77 void WebFileWriterImpl::DoCancel() { | 76 void WebFileWriterImpl::DoCancel() { |
78 GetFileSystemDispatcher()->Cancel(request_id_, | 77 GetFileSystemDispatcher()->Cancel(request_id_, |
79 new CallbackDispatcher(AsWeakPtr())); | 78 new CallbackDispatcher(AsWeakPtr())); |
80 } | 79 } |
81 | |
OLD | NEW |