Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Side by Side Diff: chrome/browser/chromeos/fileapi/cros_mount_point_provider.h

Issue 18612002: Extract Drive related code to drive::MountPointProviderDelegate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 11 matching lines...) Expand all
22 class AsyncFileUtilAdapter; 22 class AsyncFileUtilAdapter;
23 class CopyOrMoveFileValidatorFactory; 23 class CopyOrMoveFileValidatorFactory;
24 class ExternalMountPoints; 24 class ExternalMountPoints;
25 class FileSystemFileUtil; 25 class FileSystemFileUtil;
26 class FileSystemURL; 26 class FileSystemURL;
27 class IsolatedContext; 27 class IsolatedContext;
28 } 28 }
29 29
30 namespace chromeos { 30 namespace chromeos {
31 31
32 class CrosMountPointProviderDelegate;
32 class FileAccessPermissions; 33 class FileAccessPermissions;
33 34
34 // CrosMountPointProvider is a Chrome OS specific implementation of 35 // CrosMountPointProvider is a Chrome OS specific implementation of
35 // ExternalFileSystemMountPointProvider. This class is responsible for a 36 // ExternalFileSystemMountPointProvider. This class is responsible for a
36 // number of things, including: 37 // number of things, including:
37 // 38 //
38 // - Add system mount points 39 // - Add system mount points
39 // - Grant/revoke/check file access permissions 40 // - Grant/revoke/check file access permissions
40 // - Create FileSystemOperation per file system type 41 // - Create FileSystemOperation per file system type
41 // - Create FileStreamReader/Writer per file system type 42 // - Create FileStreamReader/Writer per file system type
(...skipping 23 matching lines...) Expand all
65 // 66 //
66 class CrosMountPointProvider 67 class CrosMountPointProvider
67 : public fileapi::ExternalFileSystemMountPointProvider { 68 : public fileapi::ExternalFileSystemMountPointProvider {
68 public: 69 public:
69 using fileapi::FileSystemMountPointProvider::OpenFileSystemCallback; 70 using fileapi::FileSystemMountPointProvider::OpenFileSystemCallback;
70 using fileapi::FileSystemMountPointProvider::DeleteFileSystemCallback; 71 using fileapi::FileSystemMountPointProvider::DeleteFileSystemCallback;
71 72
72 // CrosMountPointProvider will take an ownership of a |mount_points| 73 // CrosMountPointProvider will take an ownership of a |mount_points|
73 // reference. On the other hand, |system_mount_points| will be kept as a raw 74 // reference. On the other hand, |system_mount_points| will be kept as a raw
74 // pointer and it should outlive CrosMountPointProvider instance. 75 // pointer and it should outlive CrosMountPointProvider instance.
76 // The ownership of |drive_delegate| is also taken.
75 CrosMountPointProvider( 77 CrosMountPointProvider(
78 CrosMountPointProviderDelegate* drive_delegate,
76 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy, 79 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy,
77 scoped_refptr<fileapi::ExternalMountPoints> mount_points, 80 scoped_refptr<fileapi::ExternalMountPoints> mount_points,
78 fileapi::ExternalMountPoints* system_mount_points); 81 fileapi::ExternalMountPoints* system_mount_points);
79 virtual ~CrosMountPointProvider(); 82 virtual ~CrosMountPointProvider();
80 83
81 // Adds system mount points, such as "archive", and "removable". This 84 // Adds system mount points, such as "archive", and "removable". This
82 // function is no-op if these mount points are already present. 85 // function is no-op if these mount points are already present.
83 void AddSystemMountPoints(); 86 void AddSystemMountPoints();
84 87
85 // Returns true if CrosMountpointProvider can handle |url|, i.e. its 88 // Returns true if CrosMountpointProvider can handle |url|, i.e. its
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 const std::string& extension_id) OVERRIDE; 133 const std::string& extension_id) OVERRIDE;
131 virtual void GrantFileAccessToExtension( 134 virtual void GrantFileAccessToExtension(
132 const std::string& extension_id, 135 const std::string& extension_id,
133 const base::FilePath& virtual_path) OVERRIDE; 136 const base::FilePath& virtual_path) OVERRIDE;
134 virtual void RevokeAccessForExtension( 137 virtual void RevokeAccessForExtension(
135 const std::string& extension_id) OVERRIDE; 138 const std::string& extension_id) OVERRIDE;
136 virtual bool GetVirtualPath(const base::FilePath& filesystem_path, 139 virtual bool GetVirtualPath(const base::FilePath& filesystem_path,
137 base::FilePath* virtual_path) OVERRIDE; 140 base::FilePath* virtual_path) OVERRIDE;
138 141
139 private: 142 private:
140 fileapi::RemoteFileSystemProxyInterface* GetRemoteProxy(
141 const std::string& mount_name) const;
142 base::FilePath GetFileSystemRootPath(const fileapi::FileSystemURL& url) const; 143 base::FilePath GetFileSystemRootPath(const fileapi::FileSystemURL& url) const;
143 144
144 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; 145 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_;
145 scoped_ptr<FileAccessPermissions> file_access_permissions_; 146 scoped_ptr<FileAccessPermissions> file_access_permissions_;
146 scoped_ptr<fileapi::AsyncFileUtilAdapter> local_file_util_; 147 scoped_ptr<fileapi::AsyncFileUtilAdapter> local_file_util_;
147 148
149 // The Delegate instance for the drive file system related operation.
150 scoped_ptr<CrosMountPointProviderDelegate> drive_delegate_;
151
148 // Mount points specific to the owning context (i.e. per-profile mount 152 // Mount points specific to the owning context (i.e. per-profile mount
149 // points). 153 // points).
150 // 154 //
151 // It is legal to have mount points with the same name as in 155 // 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 156 // system_mount_points_. Also, mount point paths may overlap with mount point
153 // paths in system_mount_points_. In both cases mount points in 157 // paths in system_mount_points_. In both cases mount points in
154 // |mount_points_| will have a priority. 158 // |mount_points_| will have a priority.
155 // E.g. if |mount_points_| map 'foo1' to '/foo/foo1' and 159 // E.g. if |mount_points_| map 'foo1' to '/foo/foo1' and
156 // |file_system_mount_points_| map 'xxx' to '/foo/foo1/xxx', |GetVirtualPaths| 160 // |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 161 // will resolve '/foo/foo1/xxx/yyy' as 'foo1/xxx/yyy' (i.e. the mapping from
158 // |mount_points_| will be used). 162 // |mount_points_| will be used).
159 scoped_refptr<fileapi::ExternalMountPoints> mount_points_; 163 scoped_refptr<fileapi::ExternalMountPoints> mount_points_;
160 164
161 // Globally visible mount points. System MountPonts instance should outlive 165 // Globally visible mount points. System MountPonts instance should outlive
162 // all CrosMountPointProvider instances, so raw pointer is safe. 166 // all CrosMountPointProvider instances, so raw pointer is safe.
163 fileapi::ExternalMountPoints* system_mount_points_; 167 fileapi::ExternalMountPoints* system_mount_points_;
164 168
165 DISALLOW_COPY_AND_ASSIGN(CrosMountPointProvider); 169 DISALLOW_COPY_AND_ASSIGN(CrosMountPointProvider);
166 }; 170 };
167 171
168 } // namespace chromeos 172 } // namespace chromeos
169 173
170 #endif // CHROME_BROWSER_CHROMEOS_FILEAPI_CROS_MOUNT_POINT_PROVIDER_H_ 174 #endif // CHROME_BROWSER_CHROMEOS_FILEAPI_CROS_MOUNT_POINT_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698