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 <set> | |
10 #include <string> | 9 #include <string> |
| 10 #include <vector> |
11 | 11 |
| 12 #include "base/file_path.h" |
12 #include "webkit/fileapi/file_system_mount_point_provider.h" | 13 #include "webkit/fileapi/file_system_mount_point_provider.h" |
13 #include "webkit/quota/special_storage_policy.h" | 14 #include "webkit/quota/special_storage_policy.h" |
14 | 15 |
15 namespace chromeos { | 16 namespace chromeos { |
16 | 17 |
| 18 class FileAccessPermissions; |
| 19 |
17 // An interface to provide local filesystem paths. | 20 // An interface to provide local filesystem paths. |
18 class CrosMountPointProvider | 21 class CrosMountPointProvider |
19 : public fileapi::FileSystemMountPointProvider { | 22 : public fileapi::ExternalFileSystemMountPointProvider { |
20 public: | 23 public: |
21 CrosMountPointProvider( | 24 CrosMountPointProvider( |
22 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy); | 25 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy); |
23 virtual ~CrosMountPointProvider(); | 26 virtual ~CrosMountPointProvider(); |
24 | 27 |
25 // fileapi::FileSystemMountPointProvider overrides. | 28 // fileapi::FileSystemMountPointProvider overrides. |
26 virtual bool IsAccessAllowed(const GURL& origin_url) OVERRIDE; | 29 virtual bool IsAccessAllowed(const GURL& origin_url, |
27 | 30 fileapi::FileSystemType type, |
| 31 const FilePath& virtual_path) OVERRIDE; |
28 virtual void GetFileSystemRootPath( | 32 virtual void GetFileSystemRootPath( |
29 const GURL& origin_url, | 33 const GURL& origin_url, |
30 fileapi::FileSystemType type, | 34 fileapi::FileSystemType type, |
31 bool create, | 35 bool create, |
32 fileapi::FileSystemPathManager::GetRootPathCallback* callback) OVERRIDE; | 36 fileapi::FileSystemPathManager::GetRootPathCallback* callback) OVERRIDE; |
33 | |
34 virtual FilePath GetFileSystemRootPathOnFileThread( | 37 virtual FilePath GetFileSystemRootPathOnFileThread( |
35 const GURL& origin_url, | 38 const GURL& origin_url, |
36 fileapi::FileSystemType type, | 39 fileapi::FileSystemType type, |
37 const FilePath& virtual_path, | 40 const FilePath& virtual_path, |
38 bool create); | 41 bool create); |
| 42 virtual bool IsRestrictedFileName(const FilePath& filename) const OVERRIDE; |
| 43 virtual std::vector<FilePath> GetRootDirectories() const OVERRIDE; |
39 | 44 |
40 virtual bool IsRestrictedFileName(const FilePath& filename) const OVERRIDE; | 45 // fileapi::ExternalFileSystemMountPointProvider overrides. |
| 46 virtual void GrantFullAccessToExtension( |
| 47 const std::string& extension_id) OVERRIDE; |
| 48 virtual void GrantFileAccessToExtension( |
| 49 const std::string& extension_id, const FilePath& virtual_path) OVERRIDE; |
| 50 void RevokeAccessForExtension(const std::string& extension_id) OVERRIDE; |
41 | 51 |
42 private: | 52 private: |
43 class GetFileSystemRootPathTask; | 53 class GetFileSystemRootPathTask; |
44 typedef std::map<std::string, std::string> MountPointMap; | 54 typedef std::map<std::string, FilePath> MountPointMap; |
45 | 55 |
46 static const char kLocalDirName[]; | |
47 static const char kLocalName[]; | |
48 FilePath virtual_root_path_; | |
49 FilePath base_path_; | |
50 std::string local_dir_name_; | |
51 MountPointMap mount_point_map_; | 56 MountPointMap mount_point_map_; |
52 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; | 57 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; |
53 | 58 scoped_ptr<FileAccessPermissions> file_access_permissions_; |
54 DISALLOW_COPY_AND_ASSIGN(CrosMountPointProvider); | 59 DISALLOW_COPY_AND_ASSIGN(CrosMountPointProvider); |
55 }; | 60 }; |
56 | 61 |
57 } // namespace chromeos | 62 } // namespace chromeos |
58 | 63 |
59 #endif // WEBKIT_CHROMEOS_FILEAPI_CROS_MOUNT_POINT_PROVIDER_H_ | 64 #endif // WEBKIT_CHROMEOS_FILEAPI_CROS_MOUNT_POINT_PROVIDER_H_ |
OLD | NEW |