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 "webkit/fileapi/file_system_context.h" | 5 #include "webkit/fileapi/file_system_context.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 GetMountPointProvider(type); | 176 GetMountPointProvider(type); |
177 if (!mount_point_provider) { | 177 if (!mount_point_provider) { |
178 callback.Run(base::PLATFORM_FILE_ERROR_SECURITY); | 178 callback.Run(base::PLATFORM_FILE_ERROR_SECURITY); |
179 return; | 179 return; |
180 } | 180 } |
181 | 181 |
182 mount_point_provider->DeleteFileSystem(origin_url, type, this, callback); | 182 mount_point_provider->DeleteFileSystem(origin_url, type, this, callback); |
183 } | 183 } |
184 | 184 |
185 FileSystemOperation* FileSystemContext::CreateFileSystemOperation( | 185 FileSystemOperation* FileSystemContext::CreateFileSystemOperation( |
186 const FileSystemURL& url) { | 186 const FileSystemURL& url, PlatformFileError* error_code) { |
187 if (!url.is_valid()) | 187 if (!url.is_valid()) { |
| 188 if (error_code) |
| 189 *error_code = base::PLATFORM_FILE_ERROR_INVALID_URL; |
188 return NULL; | 190 return NULL; |
| 191 } |
189 FileSystemMountPointProvider* mount_point_provider = | 192 FileSystemMountPointProvider* mount_point_provider = |
190 GetMountPointProvider(url.type()); | 193 GetMountPointProvider(url.type()); |
191 if (!mount_point_provider) | 194 if (!mount_point_provider) { |
| 195 if (error_code) |
| 196 *error_code = base::PLATFORM_FILE_ERROR_FAILED; |
192 return NULL; | 197 return NULL; |
| 198 } |
| 199 |
| 200 if (error_code) |
| 201 *error_code = base::PLATFORM_FILE_OK; |
193 return mount_point_provider->CreateFileSystemOperation(url, this); | 202 return mount_point_provider->CreateFileSystemOperation(url, this); |
194 } | 203 } |
195 | 204 |
196 webkit_blob::FileStreamReader* FileSystemContext::CreateFileStreamReader( | 205 webkit_blob::FileStreamReader* FileSystemContext::CreateFileStreamReader( |
197 const FileSystemURL& url, | 206 const FileSystemURL& url, |
198 int64 offset) { | 207 int64 offset) { |
199 if (!url.is_valid()) | 208 if (!url.is_valid()) |
200 return NULL; | 209 return NULL; |
201 FileSystemMountPointProvider* mount_point_provider = | 210 FileSystemMountPointProvider* mount_point_provider = |
202 GetMountPointProvider(url.type()); | 211 GetMountPointProvider(url.type()); |
(...skipping 16 matching lines...) Expand all Loading... |
219 if (!task_runners_->io_task_runner()->RunsTasksOnCurrentThread() && | 228 if (!task_runners_->io_task_runner()->RunsTasksOnCurrentThread() && |
220 task_runners_->io_task_runner()->DeleteSoon(FROM_HERE, this)) { | 229 task_runners_->io_task_runner()->DeleteSoon(FROM_HERE, this)) { |
221 return; | 230 return; |
222 } | 231 } |
223 STLDeleteContainerPairSecondPointers(provider_map_.begin(), | 232 STLDeleteContainerPairSecondPointers(provider_map_.begin(), |
224 provider_map_.end()); | 233 provider_map_.end()); |
225 delete this; | 234 delete this; |
226 } | 235 } |
227 | 236 |
228 } // namespace fileapi | 237 } // namespace fileapi |
OLD | NEW |