Chromium Code Reviews| 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) { |
| 208 | |
|
kinuko
2012/09/06 09:15:10
nit: please remove this empty line
calvinlo
2012/09/06 11:19:32
Done.
| |
| 199 if (!url.is_valid()) | 209 if (!url.is_valid()) |
| 200 return NULL; | 210 return NULL; |
| 201 FileSystemMountPointProvider* mount_point_provider = | 211 FileSystemMountPointProvider* mount_point_provider = |
| 202 GetMountPointProvider(url.type()); | 212 GetMountPointProvider(url.type()); |
| 203 if (!mount_point_provider) | 213 if (!mount_point_provider) |
| 204 return NULL; | 214 return NULL; |
| 205 return mount_point_provider->CreateFileStreamReader(url, offset, this); | 215 return mount_point_provider->CreateFileStreamReader(url, offset, this); |
| 206 } | 216 } |
| 207 | 217 |
| 208 void FileSystemContext::RegisterMountPointProvider( | 218 void FileSystemContext::RegisterMountPointProvider( |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 219 if (!task_runners_->io_task_runner()->RunsTasksOnCurrentThread() && | 229 if (!task_runners_->io_task_runner()->RunsTasksOnCurrentThread() && |
| 220 task_runners_->io_task_runner()->DeleteSoon(FROM_HERE, this)) { | 230 task_runners_->io_task_runner()->DeleteSoon(FROM_HERE, this)) { |
| 221 return; | 231 return; |
| 222 } | 232 } |
| 223 STLDeleteContainerPairSecondPointers(provider_map_.begin(), | 233 STLDeleteContainerPairSecondPointers(provider_map_.begin(), |
| 224 provider_map_.end()); | 234 provider_map_.end()); |
| 225 delete this; | 235 delete this; |
| 226 } | 236 } |
| 227 | 237 |
| 228 } // namespace fileapi | 238 } // namespace fileapi |
| OLD | NEW |