OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CHROME_BROWSER_CHROMEOS_FILEAPI_FILE_SYSTEM_BACKEND_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_FILEAPI_FILE_SYSTEM_BACKEND_H_ |
6 #define CHROME_BROWSER_CHROMEOS_FILEAPI_FILE_SYSTEM_BACKEND_H_ | 6 #define CHROME_BROWSER_CHROMEOS_FILEAPI_FILE_SYSTEM_BACKEND_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // | 63 // |
64 // filesystem:<origin>/external/<mount_name>/... | 64 // filesystem:<origin>/external/<mount_name>/... |
65 // | 65 // |
66 class FileSystemBackend : public fileapi::ExternalFileSystemBackend { | 66 class FileSystemBackend : public fileapi::ExternalFileSystemBackend { |
67 public: | 67 public: |
68 using fileapi::FileSystemBackend::OpenFileSystemCallback; | 68 using fileapi::FileSystemBackend::OpenFileSystemCallback; |
69 | 69 |
70 // FileSystemBackend will take an ownership of a |mount_points| | 70 // FileSystemBackend will take an ownership of a |mount_points| |
71 // reference. On the other hand, |system_mount_points| will be kept as a raw | 71 // reference. On the other hand, |system_mount_points| will be kept as a raw |
72 // pointer and it should outlive FileSystemBackend instance. | 72 // pointer and it should outlive FileSystemBackend instance. |
73 // The ownerships of |drive_delegate| and |file_system_provider_delegate| are | 73 // The ownership of |drive_delegate| is also taken. |
74 // also taken. | |
75 FileSystemBackend( | 74 FileSystemBackend( |
76 FileSystemBackendDelegate* drive_delegate, | 75 FileSystemBackendDelegate* drive_delegate, |
77 FileSystemBackendDelegate* file_system_provider_delegate, | |
78 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy, | 76 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy, |
79 scoped_refptr<fileapi::ExternalMountPoints> mount_points, | 77 scoped_refptr<fileapi::ExternalMountPoints> mount_points, |
80 fileapi::ExternalMountPoints* system_mount_points); | 78 fileapi::ExternalMountPoints* system_mount_points); |
81 virtual ~FileSystemBackend(); | 79 virtual ~FileSystemBackend(); |
82 | 80 |
83 // Adds system mount points, such as "archive", and "removable". This | 81 // Adds system mount points, such as "archive", and "removable". This |
84 // function is no-op if these mount points are already present. | 82 // function is no-op if these mount points are already present. |
85 void AddSystemMountPoints(); | 83 void AddSystemMountPoints(); |
86 | 84 |
87 // Returns true if CrosMountpointProvider can handle |url|, i.e. its | 85 // Returns true if CrosMountpointProvider can handle |url|, i.e. its |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 virtual void RevokeAccessForExtension( | 128 virtual void RevokeAccessForExtension( |
131 const std::string& extension_id) OVERRIDE; | 129 const std::string& extension_id) OVERRIDE; |
132 virtual bool GetVirtualPath(const base::FilePath& filesystem_path, | 130 virtual bool GetVirtualPath(const base::FilePath& filesystem_path, |
133 base::FilePath* virtual_path) OVERRIDE; | 131 base::FilePath* virtual_path) OVERRIDE; |
134 | 132 |
135 private: | 133 private: |
136 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; | 134 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; |
137 scoped_ptr<FileAccessPermissions> file_access_permissions_; | 135 scoped_ptr<FileAccessPermissions> file_access_permissions_; |
138 scoped_ptr<fileapi::AsyncFileUtil> local_file_util_; | 136 scoped_ptr<fileapi::AsyncFileUtil> local_file_util_; |
139 | 137 |
140 // The delegate instance for the drive file system related operations. | 138 // The Delegate instance for the drive file system related operation. |
141 scoped_ptr<FileSystemBackendDelegate> drive_delegate_; | 139 scoped_ptr<FileSystemBackendDelegate> drive_delegate_; |
142 | 140 |
143 // The delegate instance for the provided file system related operations. | |
144 scoped_ptr<FileSystemBackendDelegate> file_system_provider_delegate_; | |
145 | |
146 // Mount points specific to the owning context (i.e. per-profile mount | 141 // Mount points specific to the owning context (i.e. per-profile mount |
147 // points). | 142 // points). |
148 // | 143 // |
149 // It is legal to have mount points with the same name as in | 144 // It is legal to have mount points with the same name as in |
150 // system_mount_points_. Also, mount point paths may overlap with mount point | 145 // system_mount_points_. Also, mount point paths may overlap with mount point |
151 // paths in system_mount_points_. In both cases mount points in | 146 // paths in system_mount_points_. In both cases mount points in |
152 // |mount_points_| will have a priority. | 147 // |mount_points_| will have a priority. |
153 // E.g. if |mount_points_| map 'foo1' to '/foo/foo1' and | 148 // E.g. if |mount_points_| map 'foo1' to '/foo/foo1' and |
154 // |file_system_mount_points_| map 'xxx' to '/foo/foo1/xxx', |GetVirtualPaths| | 149 // |file_system_mount_points_| map 'xxx' to '/foo/foo1/xxx', |GetVirtualPaths| |
155 // will resolve '/foo/foo1/xxx/yyy' as 'foo1/xxx/yyy' (i.e. the mapping from | 150 // will resolve '/foo/foo1/xxx/yyy' as 'foo1/xxx/yyy' (i.e. the mapping from |
156 // |mount_points_| will be used). | 151 // |mount_points_| will be used). |
157 scoped_refptr<fileapi::ExternalMountPoints> mount_points_; | 152 scoped_refptr<fileapi::ExternalMountPoints> mount_points_; |
158 | 153 |
159 // Globally visible mount points. System MountPonts instance should outlive | 154 // Globally visible mount points. System MountPonts instance should outlive |
160 // all FileSystemBackend instances, so raw pointer is safe. | 155 // all FileSystemBackend instances, so raw pointer is safe. |
161 fileapi::ExternalMountPoints* system_mount_points_; | 156 fileapi::ExternalMountPoints* system_mount_points_; |
162 | 157 |
163 DISALLOW_COPY_AND_ASSIGN(FileSystemBackend); | 158 DISALLOW_COPY_AND_ASSIGN(FileSystemBackend); |
164 }; | 159 }; |
165 | 160 |
166 } // namespace chromeos | 161 } // namespace chromeos |
167 | 162 |
168 #endif // CHROME_BROWSER_CHROMEOS_FILEAPI_FILE_SYSTEM_BACKEND_H_ | 163 #endif // CHROME_BROWSER_CHROMEOS_FILEAPI_FILE_SYSTEM_BACKEND_H_ |
OLD | NEW |