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_CROS_MOUNT_POINT_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_FILEAPI_CROS_MOUNT_POINT_PROVIDER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_FILEAPI_CROS_MOUNT_POINT_PROVIDER_H_ | 6 #define CHROME_BROWSER_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> |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 // system URLs for these mount points look like: | 62 // system URLs for these mount points look like: |
63 // | 63 // |
64 // filesystem:<origin>/external/<mount_name>/... | 64 // filesystem:<origin>/external/<mount_name>/... |
65 // | 65 // |
66 class CrosMountPointProvider | 66 class CrosMountPointProvider |
67 : public fileapi::ExternalFileSystemMountPointProvider { | 67 : public fileapi::ExternalFileSystemMountPointProvider { |
68 public: | 68 public: |
69 using fileapi::FileSystemMountPointProvider::OpenFileSystemCallback; | 69 using fileapi::FileSystemMountPointProvider::OpenFileSystemCallback; |
70 using fileapi::FileSystemMountPointProvider::DeleteFileSystemCallback; | 70 using fileapi::FileSystemMountPointProvider::DeleteFileSystemCallback; |
71 | 71 |
72 // This is delegate interface to inject Drive File System without explicit | |
73 // dependency in the header file. | |
satorux1
2013/07/03 05:44:29
I'm confused
drive::MountPointProviderDelegate is
hidehiko
2013/07/03 08:37:01
Done.
| |
74 class Delegate { | |
satorux1
2013/07/03 05:44:29
Nested classes are usually avoided:
http://google
hidehiko
2013/07/03 08:37:01
Done.
| |
75 public: | |
76 virtual ~Delegate() {} | |
77 | |
78 // Called from CrosMountPointProvider::GetAsyncFileUtil(). | |
79 virtual fileapi::AsyncFileUtil* GetAsyncFileUtil( | |
80 fileapi::FileSystemType type) = 0; | |
81 | |
82 // Called from CrosMountPointProvider::CreateFileStreamReader(). | |
83 virtual scoped_ptr<webkit_blob::FileStreamReader> CreateFileStreamReader( | |
84 const fileapi::FileSystemURL& url, | |
85 int64 offset, | |
86 const base::Time& expected_modification_time, | |
87 fileapi::FileSystemContext* context) = 0; | |
88 | |
89 // Called from CrosMountPointProvider::CreateFileStreamWriter(). | |
90 virtual scoped_ptr<fileapi::FileStreamWriter> CreateFileStreamWriter( | |
91 const fileapi::FileSystemURL& url, | |
92 int64 offset, | |
93 fileapi::FileSystemContext* context) = 0; | |
94 | |
95 // Called from CrosMountPointProvider::CreateFileSystemOperation(). | |
96 // TODO(hidehiko): Get rid of this method when we merge the | |
97 // {Remote,Local}FileSystemOperation. | |
98 virtual fileapi::FileSystemOperation* CreateFileSystemOperation( | |
99 const fileapi::FileSystemURL& url, | |
100 fileapi::FileSystemContext* context, | |
101 base::PlatformFileError* error_code) = 0; | |
102 }; | |
103 | |
72 // CrosMountPointProvider will take an ownership of a |mount_points| | 104 // CrosMountPointProvider will take an ownership of a |mount_points| |
73 // reference. On the other hand, |system_mount_points| will be kept as a raw | 105 // reference. On the other hand, |system_mount_points| will be kept as a raw |
74 // pointer and it should outlive CrosMountPointProvider instance. | 106 // pointer and it should outlive CrosMountPointProvider instance. |
75 CrosMountPointProvider( | 107 CrosMountPointProvider( |
76 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy, | 108 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy, |
77 scoped_refptr<fileapi::ExternalMountPoints> mount_points, | 109 scoped_refptr<fileapi::ExternalMountPoints> mount_points, |
78 fileapi::ExternalMountPoints* system_mount_points); | 110 fileapi::ExternalMountPoints* system_mount_points); |
79 virtual ~CrosMountPointProvider(); | 111 virtual ~CrosMountPointProvider(); |
80 | 112 |
81 // Adds system mount points, such as "archive", and "removable". This | 113 // Adds system mount points, such as "archive", and "removable". This |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
130 const std::string& extension_id) OVERRIDE; | 162 const std::string& extension_id) OVERRIDE; |
131 virtual void GrantFileAccessToExtension( | 163 virtual void GrantFileAccessToExtension( |
132 const std::string& extension_id, | 164 const std::string& extension_id, |
133 const base::FilePath& virtual_path) OVERRIDE; | 165 const base::FilePath& virtual_path) OVERRIDE; |
134 virtual void RevokeAccessForExtension( | 166 virtual void RevokeAccessForExtension( |
135 const std::string& extension_id) OVERRIDE; | 167 const std::string& extension_id) OVERRIDE; |
136 virtual bool GetVirtualPath(const base::FilePath& filesystem_path, | 168 virtual bool GetVirtualPath(const base::FilePath& filesystem_path, |
137 base::FilePath* virtual_path) OVERRIDE; | 169 base::FilePath* virtual_path) OVERRIDE; |
138 | 170 |
139 private: | 171 private: |
140 fileapi::RemoteFileSystemProxyInterface* GetRemoteProxy( | |
141 const std::string& mount_name) const; | |
142 base::FilePath GetFileSystemRootPath(const fileapi::FileSystemURL& url) const; | 172 base::FilePath GetFileSystemRootPath(const fileapi::FileSystemURL& url) const; |
143 | 173 |
144 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; | 174 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; |
145 scoped_ptr<FileAccessPermissions> file_access_permissions_; | 175 scoped_ptr<FileAccessPermissions> file_access_permissions_; |
146 scoped_ptr<fileapi::AsyncFileUtilAdapter> local_file_util_; | 176 scoped_ptr<fileapi::AsyncFileUtilAdapter> local_file_util_; |
147 | 177 |
178 // The Delegate instance for the drive file system related operation. | |
179 scoped_ptr<Delegate> drive_delegate_; | |
180 | |
148 // Mount points specific to the owning context (i.e. per-profile mount | 181 // Mount points specific to the owning context (i.e. per-profile mount |
149 // points). | 182 // points). |
150 // | 183 // |
151 // It is legal to have mount points with the same name as in | 184 // It is legal to have mount points with the same name as in |
152 // system_mount_points_. Also, mount point paths may overlap with mount point | 185 // system_mount_points_. Also, mount point paths may overlap with mount point |
153 // paths in system_mount_points_. In both cases mount points in | 186 // paths in system_mount_points_. In both cases mount points in |
154 // |mount_points_| will have a priority. | 187 // |mount_points_| will have a priority. |
155 // E.g. if |mount_points_| map 'foo1' to '/foo/foo1' and | 188 // E.g. if |mount_points_| map 'foo1' to '/foo/foo1' and |
156 // |file_system_mount_points_| map 'xxx' to '/foo/foo1/xxx', |GetVirtualPaths| | 189 // |file_system_mount_points_| map 'xxx' to '/foo/foo1/xxx', |GetVirtualPaths| |
157 // will resolve '/foo/foo1/xxx/yyy' as 'foo1/xxx/yyy' (i.e. the mapping from | 190 // will resolve '/foo/foo1/xxx/yyy' as 'foo1/xxx/yyy' (i.e. the mapping from |
158 // |mount_points_| will be used). | 191 // |mount_points_| will be used). |
159 scoped_refptr<fileapi::ExternalMountPoints> mount_points_; | 192 scoped_refptr<fileapi::ExternalMountPoints> mount_points_; |
160 | 193 |
161 // Globally visible mount points. System MountPonts instance should outlive | 194 // Globally visible mount points. System MountPonts instance should outlive |
162 // all CrosMountPointProvider instances, so raw pointer is safe. | 195 // all CrosMountPointProvider instances, so raw pointer is safe. |
163 fileapi::ExternalMountPoints* system_mount_points_; | 196 fileapi::ExternalMountPoints* system_mount_points_; |
164 | 197 |
165 DISALLOW_COPY_AND_ASSIGN(CrosMountPointProvider); | 198 DISALLOW_COPY_AND_ASSIGN(CrosMountPointProvider); |
166 }; | 199 }; |
167 | 200 |
168 } // namespace chromeos | 201 } // namespace chromeos |
169 | 202 |
170 #endif // CHROME_BROWSER_CHROMEOS_FILEAPI_CROS_MOUNT_POINT_PROVIDER_H_ | 203 #endif // CHROME_BROWSER_CHROMEOS_FILEAPI_CROS_MOUNT_POINT_PROVIDER_H_ |
OLD | NEW |