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 } | |
tzik
2012/09/06 05:59:07
Could you insert below?
if (error_code)
*error_c
| |
193 return mount_point_provider->CreateFileSystemOperation(url, this); | 199 return mount_point_provider->CreateFileSystemOperation(url, this); |
194 } | 200 } |
195 | 201 |
196 webkit_blob::FileStreamReader* FileSystemContext::CreateFileStreamReader( | 202 webkit_blob::FileStreamReader* FileSystemContext::CreateFileStreamReader( |
197 const FileSystemURL& url, | 203 const FileSystemURL& url, |
198 int64 offset) { | 204 int64 offset) { |
205 | |
199 if (!url.is_valid()) | 206 if (!url.is_valid()) |
200 return NULL; | 207 return NULL; |
201 FileSystemMountPointProvider* mount_point_provider = | 208 FileSystemMountPointProvider* mount_point_provider = |
202 GetMountPointProvider(url.type()); | 209 GetMountPointProvider(url.type()); |
203 if (!mount_point_provider) | 210 if (!mount_point_provider) |
204 return NULL; | 211 return NULL; |
205 return mount_point_provider->CreateFileStreamReader(url, offset, this); | 212 return mount_point_provider->CreateFileStreamReader(url, offset, this); |
206 } | 213 } |
207 | 214 |
208 void FileSystemContext::RegisterMountPointProvider( | 215 void FileSystemContext::RegisterMountPointProvider( |
(...skipping 10 matching lines...) Expand all Loading... | |
219 if (!task_runners_->io_task_runner()->RunsTasksOnCurrentThread() && | 226 if (!task_runners_->io_task_runner()->RunsTasksOnCurrentThread() && |
220 task_runners_->io_task_runner()->DeleteSoon(FROM_HERE, this)) { | 227 task_runners_->io_task_runner()->DeleteSoon(FROM_HERE, this)) { |
221 return; | 228 return; |
222 } | 229 } |
223 STLDeleteContainerPairSecondPointers(provider_map_.begin(), | 230 STLDeleteContainerPairSecondPointers(provider_map_.begin(), |
224 provider_map_.end()); | 231 provider_map_.end()); |
225 delete this; | 232 delete this; |
226 } | 233 } |
227 | 234 |
228 } // namespace fileapi | 235 } // namespace fileapi |
OLD | NEW |