OLD | NEW |
| (Empty) |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/local_discovery/storage/privet_filesystem_async_util.h" | |
6 | |
7 #include "chrome/browser/local_discovery/storage/path_util.h" | |
8 #include "webkit/browser/fileapi/file_system_url.h" | |
9 #include "webkit/common/blob/shareable_file_reference.h" | |
10 | |
11 namespace local_discovery { | |
12 | |
13 PrivetFileSystemAsyncUtil::PrivetFileSystemAsyncUtil( | |
14 content::BrowserContext* browser_context) { | |
15 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | |
16 operation_factory_ = new PrivetFileSystemOperationFactory(browser_context); | |
17 } | |
18 | |
19 PrivetFileSystemAsyncUtil::~PrivetFileSystemAsyncUtil() { | |
20 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | |
21 content::BrowserThread::DeleteSoon( | |
22 content::BrowserThread::UI, FROM_HERE, operation_factory_); | |
23 } | |
24 | |
25 void PrivetFileSystemAsyncUtil::CreateOrOpen( | |
26 scoped_ptr<storage::FileSystemOperationContext> context, | |
27 const storage::FileSystemURL& url, | |
28 int file_flags, | |
29 const CreateOrOpenCallback& callback) { | |
30 NOTIMPLEMENTED(); | |
31 callback.Run(base::File(base::File::FILE_ERROR_INVALID_OPERATION), | |
32 base::Closure()); | |
33 } | |
34 | |
35 void PrivetFileSystemAsyncUtil::EnsureFileExists( | |
36 scoped_ptr<storage::FileSystemOperationContext> context, | |
37 const storage::FileSystemURL& url, | |
38 const EnsureFileExistsCallback& callback) { | |
39 NOTIMPLEMENTED(); | |
40 callback.Run(base::File::FILE_ERROR_INVALID_OPERATION, false); | |
41 } | |
42 | |
43 void PrivetFileSystemAsyncUtil::CreateDirectory( | |
44 scoped_ptr<storage::FileSystemOperationContext> context, | |
45 const storage::FileSystemURL& url, | |
46 bool exclusive, | |
47 bool recursive, | |
48 const StatusCallback& callback) { | |
49 NOTIMPLEMENTED(); | |
50 callback.Run(base::File::FILE_ERROR_INVALID_OPERATION); | |
51 } | |
52 | |
53 void PrivetFileSystemAsyncUtil::GetFileInfo( | |
54 scoped_ptr<storage::FileSystemOperationContext> context, | |
55 const storage::FileSystemURL& url, | |
56 const GetFileInfoCallback& callback) { | |
57 ParsedPrivetPath parsed_path(url.path()); | |
58 | |
59 if (parsed_path.path == "/") { | |
60 base::File::Info file_info; | |
61 file_info.is_directory = true; | |
62 file_info.is_symbolic_link = false; | |
63 callback.Run(base::File::FILE_OK, file_info); | |
64 return; | |
65 } | |
66 | |
67 content::BrowserThread::PostTask( | |
68 content::BrowserThread::UI, | |
69 FROM_HERE, | |
70 base::Bind(&PrivetFileSystemOperationFactory::GetFileInfo, | |
71 operation_factory_->GetWeakPtr(), | |
72 url, | |
73 callback)); | |
74 } | |
75 | |
76 void PrivetFileSystemAsyncUtil::ReadDirectory( | |
77 scoped_ptr<storage::FileSystemOperationContext> context, | |
78 const storage::FileSystemURL& url, | |
79 const ReadDirectoryCallback& callback) { | |
80 content::BrowserThread::PostTask( | |
81 content::BrowserThread::UI, | |
82 FROM_HERE, | |
83 base::Bind(&PrivetFileSystemOperationFactory::ReadDirectory, | |
84 operation_factory_->GetWeakPtr(), | |
85 url, | |
86 callback)); | |
87 } | |
88 | |
89 void PrivetFileSystemAsyncUtil::Touch( | |
90 scoped_ptr<storage::FileSystemOperationContext> context, | |
91 const storage::FileSystemURL& url, | |
92 const base::Time& last_access_time, | |
93 const base::Time& last_modified_time, | |
94 const StatusCallback& callback) { | |
95 NOTIMPLEMENTED(); | |
96 callback.Run(base::File::FILE_ERROR_INVALID_OPERATION); | |
97 } | |
98 | |
99 void PrivetFileSystemAsyncUtil::Truncate( | |
100 scoped_ptr<storage::FileSystemOperationContext> context, | |
101 const storage::FileSystemURL& url, | |
102 int64 length, | |
103 const StatusCallback& callback) { | |
104 NOTIMPLEMENTED(); | |
105 callback.Run(base::File::FILE_ERROR_INVALID_OPERATION); | |
106 } | |
107 | |
108 void PrivetFileSystemAsyncUtil::CopyFileLocal( | |
109 scoped_ptr<storage::FileSystemOperationContext> context, | |
110 const storage::FileSystemURL& src_url, | |
111 const storage::FileSystemURL& dest_url, | |
112 CopyOrMoveOption option, | |
113 const CopyFileProgressCallback& progress_callback, | |
114 const StatusCallback& callback) { | |
115 NOTIMPLEMENTED(); | |
116 callback.Run(base::File::FILE_ERROR_INVALID_OPERATION); | |
117 } | |
118 | |
119 void PrivetFileSystemAsyncUtil::MoveFileLocal( | |
120 scoped_ptr<storage::FileSystemOperationContext> context, | |
121 const storage::FileSystemURL& src_url, | |
122 const storage::FileSystemURL& dest_url, | |
123 CopyOrMoveOption option, | |
124 const StatusCallback& callback) { | |
125 NOTIMPLEMENTED(); | |
126 callback.Run(base::File::FILE_ERROR_INVALID_OPERATION); | |
127 } | |
128 | |
129 void PrivetFileSystemAsyncUtil::CopyInForeignFile( | |
130 scoped_ptr<storage::FileSystemOperationContext> context, | |
131 const base::FilePath& src_file_path, | |
132 const storage::FileSystemURL& dest_url, | |
133 const StatusCallback& callback) { | |
134 NOTIMPLEMENTED(); | |
135 callback.Run(base::File::FILE_ERROR_INVALID_OPERATION); | |
136 } | |
137 | |
138 void PrivetFileSystemAsyncUtil::DeleteFile( | |
139 scoped_ptr<storage::FileSystemOperationContext> context, | |
140 const storage::FileSystemURL& url, | |
141 const StatusCallback& callback) { | |
142 NOTIMPLEMENTED(); | |
143 callback.Run(base::File::FILE_ERROR_INVALID_OPERATION); | |
144 } | |
145 | |
146 void PrivetFileSystemAsyncUtil::DeleteDirectory( | |
147 scoped_ptr<storage::FileSystemOperationContext> context, | |
148 const storage::FileSystemURL& url, | |
149 const StatusCallback& callback) { | |
150 NOTIMPLEMENTED(); | |
151 callback.Run(base::File::FILE_ERROR_INVALID_OPERATION); | |
152 } | |
153 | |
154 void PrivetFileSystemAsyncUtil::DeleteRecursively( | |
155 scoped_ptr<storage::FileSystemOperationContext> context, | |
156 const storage::FileSystemURL& url, | |
157 const StatusCallback& callback) { | |
158 NOTIMPLEMENTED(); | |
159 callback.Run(base::File::FILE_ERROR_INVALID_OPERATION); | |
160 } | |
161 | |
162 void PrivetFileSystemAsyncUtil::CreateSnapshotFile( | |
163 scoped_ptr<storage::FileSystemOperationContext> context, | |
164 const storage::FileSystemURL& url, | |
165 const CreateSnapshotFileCallback& callback) { | |
166 NOTIMPLEMENTED(); | |
167 callback.Run(base::File::FILE_ERROR_INVALID_OPERATION, | |
168 base::File::Info(), | |
169 base::FilePath(), | |
170 scoped_refptr<storage::ShareableFileReference>()); | |
171 } | |
172 | |
173 } // namespace local_discovery | |
OLD | NEW |