OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_system/webfilewriter_impl.h" | 5 #include "content/common/file_system/webfilewriter_impl.h" |
6 | 6 |
7 #include "content/common/child_thread.h" | 7 #include "content/common/child_thread.h" |
8 #include "content/common/file_system/file_system_dispatcher.h" | 8 #include "content/common/file_system/file_system_dispatcher.h" |
9 | 9 |
10 namespace { | 10 namespace { |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 virtual void DidReadMetadata(const base::PlatformFileInfo&, const FilePath&) { | 26 virtual void DidReadMetadata(const base::PlatformFileInfo&, const FilePath&) { |
27 NOTREACHED(); | 27 NOTREACHED(); |
28 } | 28 } |
29 virtual void DidReadDirectory( | 29 virtual void DidReadDirectory( |
30 const std::vector<base::FileUtilProxy::Entry>& entries, | 30 const std::vector<base::FileUtilProxy::Entry>& entries, |
31 bool has_more) { | 31 bool has_more) { |
32 NOTREACHED(); | 32 NOTREACHED(); |
33 } | 33 } |
34 virtual void DidOpenFileSystem(const std::string& name, | 34 virtual void DidOpenFileSystem(const std::string& name, |
35 const FilePath& root_path) { | 35 const GURL& root) { |
36 NOTREACHED(); | 36 NOTREACHED(); |
37 } | 37 } |
38 virtual void DidSucceed() { | 38 virtual void DidSucceed() { |
39 if (writer_) | 39 if (writer_) |
40 writer_->DidSucceed(); | 40 writer_->DidSucceed(); |
41 } | 41 } |
42 virtual void DidFail(base::PlatformFileError error_code) { | 42 virtual void DidFail(base::PlatformFileError error_code) { |
43 if (writer_) | 43 if (writer_) |
44 writer_->DidFail(error_code); | 44 writer_->DidFail(error_code); |
45 } | 45 } |
46 virtual void DidWrite(int64 bytes, bool complete) { | 46 virtual void DidWrite(int64 bytes, bool complete) { |
47 if (writer_) | 47 if (writer_) |
48 writer_->DidWrite(bytes, complete); | 48 writer_->DidWrite(bytes, complete); |
49 } | 49 } |
50 | 50 |
51 private: | 51 private: |
52 base::WeakPtr<WebFileWriterImpl> writer_; | 52 base::WeakPtr<WebFileWriterImpl> writer_; |
53 }; | 53 }; |
54 | 54 |
55 WebFileWriterImpl::WebFileWriterImpl( | 55 WebFileWriterImpl::WebFileWriterImpl( |
56 const WebKit::WebString& path, WebKit::WebFileWriterClient* client) | 56 const GURL& path, WebKit::WebFileWriterClient* client) |
57 : WebFileWriterBase(path, client), | 57 : WebFileWriterBase(path, client), |
58 request_id_(0) { | 58 request_id_(0) { |
59 } | 59 } |
60 | 60 |
61 WebFileWriterImpl::~WebFileWriterImpl() { | 61 WebFileWriterImpl::~WebFileWriterImpl() { |
62 } | 62 } |
63 | 63 |
64 void WebFileWriterImpl::DoTruncate(const FilePath& path, int64 offset) { | 64 void WebFileWriterImpl::DoTruncate(const GURL& path, int64 offset) { |
65 // The FileSystemDispatcher takes ownership of the CallbackDispatcher. | 65 // The FileSystemDispatcher takes ownership of the CallbackDispatcher. |
66 GetFileSystemDispatcher()->Truncate(path, offset, &request_id_, | 66 GetFileSystemDispatcher()->Truncate(path, offset, &request_id_, |
67 new CallbackDispatcher(AsWeakPtr())); | 67 new CallbackDispatcher(AsWeakPtr())); |
68 } | 68 } |
69 | 69 |
70 void WebFileWriterImpl::DoWrite( | 70 void WebFileWriterImpl::DoWrite( |
71 const FilePath& path, const GURL& blob_url, int64 offset) { | 71 const GURL& path, const GURL& blob_url, int64 offset) { |
72 GetFileSystemDispatcher()->Write(path, blob_url, offset, &request_id_, | 72 GetFileSystemDispatcher()->Write( |
73 new CallbackDispatcher(AsWeakPtr())); | 73 path, blob_url, offset, &request_id_, |
| 74 new CallbackDispatcher(AsWeakPtr())); |
74 } | 75 } |
75 | 76 |
76 void WebFileWriterImpl::DoCancel() { | 77 void WebFileWriterImpl::DoCancel() { |
77 GetFileSystemDispatcher()->Cancel(request_id_, | 78 GetFileSystemDispatcher()->Cancel(request_id_, |
78 new CallbackDispatcher(AsWeakPtr())); | 79 new CallbackDispatcher(AsWeakPtr())); |
79 } | 80 } |
OLD | NEW |