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 "base/synchronization/lock.h" |
14 #include "webkit/fileapi/file_system_mount_point_provider.h" | 14 #include "webkit/fileapi/file_system_mount_point_provider.h" |
15 #include "webkit/fileapi/local_file_system_file_util.h" | 15 #include "webkit/fileapi/local_file_util.h" |
16 #include "webkit/quota/special_storage_policy.h" | 16 #include "webkit/quota/special_storage_policy.h" |
17 | 17 |
18 namespace fileapi { | 18 namespace fileapi { |
19 class FileSystemFileUtil; | 19 class FileSystemFileUtil; |
20 } | 20 } |
21 | 21 |
22 namespace chromeos { | 22 namespace chromeos { |
23 | 23 |
24 class FileAccessPermissions; | 24 class FileAccessPermissions; |
25 | 25 |
(...skipping 14 matching lines...) Expand all Loading... |
40 fileapi::FileSystemType type, | 40 fileapi::FileSystemType type, |
41 bool create, | 41 bool create, |
42 fileapi::FileSystemPathManager::GetRootPathCallback* callback) OVERRIDE; | 42 fileapi::FileSystemPathManager::GetRootPathCallback* callback) OVERRIDE; |
43 virtual FilePath ValidateFileSystemRootAndGetPathOnFileThread( | 43 virtual FilePath ValidateFileSystemRootAndGetPathOnFileThread( |
44 const GURL& origin_url, | 44 const GURL& origin_url, |
45 fileapi::FileSystemType type, | 45 fileapi::FileSystemType type, |
46 const FilePath& virtual_path, | 46 const FilePath& virtual_path, |
47 bool create); | 47 bool create); |
48 virtual bool IsRestrictedFileName(const FilePath& filename) const OVERRIDE; | 48 virtual bool IsRestrictedFileName(const FilePath& filename) const OVERRIDE; |
49 virtual std::vector<FilePath> GetRootDirectories() const OVERRIDE; | 49 virtual std::vector<FilePath> GetRootDirectories() const OVERRIDE; |
50 virtual fileapi::FileSystemFileUtil* GetFileSystemFileUtil() OVERRIDE; | 50 virtual fileapi::FileSystemFileUtil* GetFileUtil() OVERRIDE; |
51 | 51 |
52 // fileapi::ExternalFileSystemMountPointProvider overrides. | 52 // fileapi::ExternalFileSystemMountPointProvider overrides. |
53 virtual void GrantFullAccessToExtension( | 53 virtual void GrantFullAccessToExtension( |
54 const std::string& extension_id) OVERRIDE; | 54 const std::string& extension_id) OVERRIDE; |
55 virtual void GrantFileAccessToExtension( | 55 virtual void GrantFileAccessToExtension( |
56 const std::string& extension_id, const FilePath& virtual_path) OVERRIDE; | 56 const std::string& extension_id, const FilePath& virtual_path) OVERRIDE; |
57 virtual void RevokeAccessForExtension( | 57 virtual void RevokeAccessForExtension( |
58 const std::string& extension_id) OVERRIDE; | 58 const std::string& extension_id) OVERRIDE; |
59 virtual void AddMountPoint(FilePath mount_point) OVERRIDE; | 59 virtual void AddMountPoint(FilePath mount_point) OVERRIDE; |
60 virtual void RemoveMountPoint(FilePath mount_point) OVERRIDE; | 60 virtual void RemoveMountPoint(FilePath mount_point) OVERRIDE; |
61 virtual bool GetVirtualPath(const FilePath& filesystem_path, | 61 virtual bool GetVirtualPath(const FilePath& filesystem_path, |
62 FilePath* virtual_path) OVERRIDE; | 62 FilePath* virtual_path) OVERRIDE; |
63 | 63 |
64 private: | 64 private: |
65 class GetFileSystemRootPathTask; | 65 class GetFileSystemRootPathTask; |
66 typedef std::map<std::string, FilePath> MountPointMap; | 66 typedef std::map<std::string, FilePath> MountPointMap; |
67 | 67 |
68 // Gives the real file system's |root_path| for given |virtual_path|. Returns | 68 // Gives the real file system's |root_path| for given |virtual_path|. Returns |
69 // false when |virtual_path| cannot be mapped to the real file system. | 69 // false when |virtual_path| cannot be mapped to the real file system. |
70 bool GetRootForVirtualPath(const FilePath& virtual_path, FilePath* root_path); | 70 bool GetRootForVirtualPath(const FilePath& virtual_path, FilePath* root_path); |
71 | 71 |
72 base::Lock lock_; // Synchronize all access to path_map_. | 72 base::Lock lock_; // Synchronize all access to path_map_. |
73 MountPointMap mount_point_map_; | 73 MountPointMap mount_point_map_; |
74 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; | 74 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; |
75 scoped_ptr<FileAccessPermissions> file_access_permissions_; | 75 scoped_ptr<FileAccessPermissions> file_access_permissions_; |
76 scoped_ptr<fileapi::LocalFileSystemFileUtil> local_file_util_; | 76 scoped_ptr<fileapi::LocalFileUtil> local_file_util_; |
77 DISALLOW_COPY_AND_ASSIGN(CrosMountPointProvider); | 77 DISALLOW_COPY_AND_ASSIGN(CrosMountPointProvider); |
78 }; | 78 }; |
79 | 79 |
80 } // namespace chromeos | 80 } // namespace chromeos |
81 | 81 |
82 #endif // WEBKIT_CHROMEOS_FILEAPI_CROS_MOUNT_POINT_PROVIDER_H_ | 82 #endif // WEBKIT_CHROMEOS_FILEAPI_CROS_MOUNT_POINT_PROVIDER_H_ |
OLD | NEW |