| 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 #ifndef WEBKIT_CHROMEOS_FILEAPI_CROS_MOUNT_POINT_PROVIDER_H_ | 5 #ifndef WEBKIT_CHROMEOS_FILEAPI_CROS_MOUNT_POINT_PROVIDER_H_ |
| 6 #define WEBKIT_CHROMEOS_FILEAPI_CROS_MOUNT_POINT_PROVIDER_H_ | 6 #define WEBKIT_CHROMEOS_FILEAPI_CROS_MOUNT_POINT_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 13 #include "base/synchronization/lock.h" |
| 13 #include "webkit/fileapi/file_system_mount_point_provider.h" | 14 #include "webkit/fileapi/file_system_mount_point_provider.h" |
| 14 #include "webkit/quota/special_storage_policy.h" | 15 #include "webkit/quota/special_storage_policy.h" |
| 15 | 16 |
| 16 namespace chromeos { | 17 namespace chromeos { |
| 17 | 18 |
| 18 class FileAccessPermissions; | 19 class FileAccessPermissions; |
| 19 | 20 |
| 20 // An interface to provide local filesystem paths. | 21 // An interface to provide local filesystem paths. |
| 21 class CrosMountPointProvider | 22 class CrosMountPointProvider |
| 22 : public fileapi::ExternalFileSystemMountPointProvider { | 23 : public fileapi::ExternalFileSystemMountPointProvider { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 40 const FilePath& virtual_path, | 41 const FilePath& virtual_path, |
| 41 bool create); | 42 bool create); |
| 42 virtual bool IsRestrictedFileName(const FilePath& filename) const OVERRIDE; | 43 virtual bool IsRestrictedFileName(const FilePath& filename) const OVERRIDE; |
| 43 virtual std::vector<FilePath> GetRootDirectories() const OVERRIDE; | 44 virtual std::vector<FilePath> GetRootDirectories() const OVERRIDE; |
| 44 | 45 |
| 45 // fileapi::ExternalFileSystemMountPointProvider overrides. | 46 // fileapi::ExternalFileSystemMountPointProvider overrides. |
| 46 virtual void GrantFullAccessToExtension( | 47 virtual void GrantFullAccessToExtension( |
| 47 const std::string& extension_id) OVERRIDE; | 48 const std::string& extension_id) OVERRIDE; |
| 48 virtual void GrantFileAccessToExtension( | 49 virtual void GrantFileAccessToExtension( |
| 49 const std::string& extension_id, const FilePath& virtual_path) OVERRIDE; | 50 const std::string& extension_id, const FilePath& virtual_path) OVERRIDE; |
| 50 void RevokeAccessForExtension(const std::string& extension_id) OVERRIDE; | 51 virtual void RevokeAccessForExtension( |
| 52 const std::string& extension_id) OVERRIDE; |
| 53 virtual void AddMountPoint(FilePath mount_point) OVERRIDE; |
| 54 virtual void RemoveMountPoint(FilePath mount_point) OVERRIDE; |
| 51 | 55 |
| 52 private: | 56 private: |
| 53 class GetFileSystemRootPathTask; | 57 class GetFileSystemRootPathTask; |
| 54 typedef std::map<std::string, FilePath> MountPointMap; | 58 typedef std::map<std::string, FilePath> MountPointMap; |
| 55 | 59 |
| 60 // Gives the real file system's |root_path| for given |virtual_path|. Returns |
| 61 // false when |virtual_path| cannot be mapped to the real file system. |
| 62 bool GetRootForVirtualPath(const FilePath& virtual_path, FilePath* root_path); |
| 63 |
| 64 base::Lock lock_; // Synchronize all access to path_map_. |
| 56 MountPointMap mount_point_map_; | 65 MountPointMap mount_point_map_; |
| 57 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; | 66 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; |
| 58 scoped_ptr<FileAccessPermissions> file_access_permissions_; | 67 scoped_ptr<FileAccessPermissions> file_access_permissions_; |
| 59 DISALLOW_COPY_AND_ASSIGN(CrosMountPointProvider); | 68 DISALLOW_COPY_AND_ASSIGN(CrosMountPointProvider); |
| 60 }; | 69 }; |
| 61 | 70 |
| 62 } // namespace chromeos | 71 } // namespace chromeos |
| 63 | 72 |
| 64 #endif // WEBKIT_CHROMEOS_FILEAPI_CROS_MOUNT_POINT_PROVIDER_H_ | 73 #endif // WEBKIT_CHROMEOS_FILEAPI_CROS_MOUNT_POINT_PROVIDER_H_ |
| OLD | NEW |