| 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 "webkit/fileapi/sandbox_mount_point_provider.h" | 5 #include "webkit/fileapi/sandbox_mount_point_provider.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_callback_factory.h" | 8 #include "base/memory/scoped_callback_factory.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 } | 213 } |
| 214 | 214 |
| 215 std::vector<FilePath> SandboxMountPointProvider::GetRootDirectories() const { | 215 std::vector<FilePath> SandboxMountPointProvider::GetRootDirectories() const { |
| 216 NOTREACHED(); | 216 NOTREACHED(); |
| 217 // TODO(ericu): Implement this method and check for access permissions as | 217 // TODO(ericu): Implement this method and check for access permissions as |
| 218 // fileBrowserPrivate extension API does. We currently have another mechanism, | 218 // fileBrowserPrivate extension API does. We currently have another mechanism, |
| 219 // but we should switch over. | 219 // but we should switch over. |
| 220 return std::vector<FilePath>(); | 220 return std::vector<FilePath>(); |
| 221 } | 221 } |
| 222 | 222 |
| 223 void SandboxMountPointProvider::GetFileSystemRootPath( | 223 void SandboxMountPointProvider::ValidateFileSystemRootAndGetURL( |
| 224 const GURL& origin_url, fileapi::FileSystemType type, | 224 const GURL& origin_url, fileapi::FileSystemType type, |
| 225 bool create, FileSystemPathManager::GetRootPathCallback* callback_ptr) { | 225 bool create, FileSystemPathManager::GetRootPathCallback* callback_ptr) { |
| 226 scoped_ptr<FileSystemPathManager::GetRootPathCallback> callback(callback_ptr); | 226 scoped_ptr<FileSystemPathManager::GetRootPathCallback> callback(callback_ptr); |
| 227 std::string name; | 227 std::string name; |
| 228 FilePath origin_base_path; | 228 FilePath origin_base_path; |
| 229 | 229 |
| 230 if (!GetOriginBasePathAndName(origin_url, &origin_base_path, type, &name)) { | 230 if (!GetOriginBasePathAndName(origin_url, &origin_base_path, type, &name)) { |
| 231 callback->Run(false, FilePath(), std::string()); | 231 callback->Run(false, FilePath(), std::string()); |
| 232 return; | 232 return; |
| 233 } | 233 } |
| 234 | 234 |
| 235 scoped_refptr<GetFileSystemRootPathTask> task( | 235 scoped_refptr<GetFileSystemRootPathTask> task( |
| 236 new GetFileSystemRootPathTask(file_message_loop_, | 236 new GetFileSystemRootPathTask(file_message_loop_, |
| 237 name, | 237 name, |
| 238 callback.release())); | 238 callback.release())); |
| 239 task->Start(origin_url, origin_base_path, create); | 239 task->Start(origin_url, origin_base_path, create); |
| 240 }; | 240 }; |
| 241 | 241 |
| 242 FilePath SandboxMountPointProvider::GetFileSystemRootPathOnFileThread( | 242 FilePath |
| 243 SandboxMountPointProvider::ValidateFileSystemRootAndGetPathOnFileThread( |
| 243 const GURL& origin_url, FileSystemType type, const FilePath& unused, | 244 const GURL& origin_url, FileSystemType type, const FilePath& unused, |
| 244 bool create) { | 245 bool create) { |
| 245 FilePath origin_base_path; | 246 FilePath origin_base_path; |
| 246 if (!GetOriginBasePathAndName(origin_url, &origin_base_path, type, NULL)) { | 247 if (!GetOriginBasePathAndName(origin_url, &origin_base_path, type, NULL)) { |
| 247 return FilePath(); | 248 return FilePath(); |
| 248 } | 249 } |
| 249 return GetFileSystemRootPathOnFileThreadHelper( | 250 return GetFileSystemRootPathOnFileThreadHelper( |
| 250 origin_url, origin_base_path, create); | 251 origin_url, origin_base_path, create); |
| 251 } | 252 } |
| 252 | 253 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 | 317 |
| 317 std::string type_string = | 318 std::string type_string = |
| 318 FileSystemPathManager::GetFileSystemTypeString(type); | 319 FileSystemPathManager::GetFileSystemTypeString(type); |
| 319 DCHECK(!type_string.empty()); | 320 DCHECK(!type_string.empty()); |
| 320 if (name) | 321 if (name) |
| 321 *name = origin_identifier + ":" + type_string; | 322 *name = origin_identifier + ":" + type_string; |
| 322 return true; | 323 return true; |
| 323 } | 324 } |
| 324 | 325 |
| 325 } // namespace fileapi | 326 } // namespace fileapi |
| OLD | NEW |