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

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

Issue 18344013: fileapi: Rename FileSystemMountProvider to FileSystemBackend (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_FILE_SYSTEM_BACKEND_H_
6 #define CHROME_BROWSER_CHROMEOS_FILEAPI_CROS_MOUNT_POINT_PROVIDER_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>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/synchronization/lock.h" 15 #include "base/synchronization/lock.h"
16 #include "webkit/browser/fileapi/file_system_mount_point_provider.h" 16 #include "webkit/browser/fileapi/file_system_backend.h"
17 #include "webkit/browser/quota/special_storage_policy.h" 17 #include "webkit/browser/quota/special_storage_policy.h"
18 #include "webkit/browser/webkit_storage_browser_export.h" 18 #include "webkit/browser/webkit_storage_browser_export.h"
19 #include "webkit/common/fileapi/file_system_types.h" 19 #include "webkit/common/fileapi/file_system_types.h"
20 20
21 namespace fileapi { 21 namespace fileapi {
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 FileAccessPermissions; 32 class FileAccessPermissions;
33 33
34 // CrosMountPointProvider is a Chrome OS specific implementation of 34 // FileSystemBackend is a Chrome OS specific implementation of
35 // ExternalFileSystemMountPointProvider. This class is responsible for a 35 // ExternalFileSystemBackend. This class is responsible for a
36 // number of things, including: 36 // number of things, including:
37 // 37 //
38 // - Add system mount points 38 // - Add system mount points
39 // - Grant/revoke/check file access permissions 39 // - Grant/revoke/check file access permissions
40 // - Create FileSystemOperation per file system type 40 // - Create FileSystemOperation per file system type
41 // - Create FileStreamReader/Writer per file system type 41 // - Create FileStreamReader/Writer per file system type
42 // 42 //
43 // Chrome OS specific mount points: 43 // Chrome OS specific mount points:
44 // 44 //
45 // "Downloads" is a mount point for user's Downloads directory on the local 45 // "Downloads" is a mount point for user's Downloads directory on the local
(...skipping 10 matching lines...) Expand all
56 // 56 //
57 // "drive" is a mount point for Google Drive. Drive is integrated with the 57 // "drive" is a mount point for Google Drive. Drive is integrated with the
58 // FileSystem API layer via drive::FileSystemProxy. This mount point is added 58 // FileSystem API layer via drive::FileSystemProxy. This mount point is added
59 // by drive::DriveIntegrationService. 59 // by drive::DriveIntegrationService.
60 // 60 //
61 // These mount points are placed under the "external" namespace, and file 61 // These mount points are placed under the "external" namespace, and file
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 FileSystemBackend : public fileapi::ExternalFileSystemBackend {
67 : public fileapi::ExternalFileSystemMountPointProvider {
68 public: 67 public:
69 using fileapi::FileSystemMountPointProvider::OpenFileSystemCallback; 68 using fileapi::FileSystemBackend::OpenFileSystemCallback;
70 using fileapi::FileSystemMountPointProvider::DeleteFileSystemCallback; 69 using fileapi::FileSystemBackend::DeleteFileSystemCallback;
71 70
72 // CrosMountPointProvider will take an ownership of a |mount_points| 71 // FileSystemBackend will take an ownership of a |mount_points|
73 // reference. On the other hand, |system_mount_points| will be kept as a raw 72 // reference. On the other hand, |system_mount_points| will be kept as a raw
74 // pointer and it should outlive CrosMountPointProvider instance. 73 // pointer and it should outlive FileSystemBackend instance.
75 CrosMountPointProvider( 74 FileSystemBackend(
76 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy, 75 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy,
77 scoped_refptr<fileapi::ExternalMountPoints> mount_points, 76 scoped_refptr<fileapi::ExternalMountPoints> mount_points,
78 fileapi::ExternalMountPoints* system_mount_points); 77 fileapi::ExternalMountPoints* system_mount_points);
79 virtual ~CrosMountPointProvider(); 78 virtual ~FileSystemBackend();
80 79
81 // Adds system mount points, such as "archive", and "removable". This 80 // Adds system mount points, such as "archive", and "removable". This
82 // function is no-op if these mount points are already present. 81 // function is no-op if these mount points are already present.
83 void AddSystemMountPoints(); 82 void AddSystemMountPoints();
84 83
85 // Returns true if CrosMountpointProvider can handle |url|, i.e. its 84 // Returns true if CrosMountpointProvider can handle |url|, i.e. its
86 // file system type matches with what this provider supports. 85 // file system type matches with what this provider supports.
87 // This could be called on any threads. 86 // This could be called on any threads.
88 static bool CanHandleURL(const fileapi::FileSystemURL& url); 87 static bool CanHandleURL(const fileapi::FileSystemURL& url);
89 88
90 // fileapi::FileSystemMountPointProvider overrides. 89 // fileapi::FileSystemBackend overrides.
91 virtual bool CanHandleType(fileapi::FileSystemType type) const OVERRIDE; 90 virtual bool CanHandleType(fileapi::FileSystemType type) const OVERRIDE;
92 virtual void OpenFileSystem( 91 virtual void OpenFileSystem(
93 const GURL& origin_url, 92 const GURL& origin_url,
94 fileapi::FileSystemType type, 93 fileapi::FileSystemType type,
95 fileapi::OpenFileSystemMode mode, 94 fileapi::OpenFileSystemMode mode,
96 const OpenFileSystemCallback& callback) OVERRIDE; 95 const OpenFileSystemCallback& callback) OVERRIDE;
97 virtual fileapi::FileSystemFileUtil* GetFileUtil( 96 virtual fileapi::FileSystemFileUtil* GetFileUtil(
98 fileapi::FileSystemType type) OVERRIDE; 97 fileapi::FileSystemType type) OVERRIDE;
99 virtual fileapi::AsyncFileUtil* GetAsyncFileUtil( 98 virtual fileapi::AsyncFileUtil* GetAsyncFileUtil(
100 fileapi::FileSystemType type) OVERRIDE; 99 fileapi::FileSystemType type) OVERRIDE;
(...skipping 14 matching lines...) Expand all
115 const fileapi::FileSystemURL& url, 114 const fileapi::FileSystemURL& url,
116 int64 offset, 115 int64 offset,
117 fileapi::FileSystemContext* context) const OVERRIDE; 116 fileapi::FileSystemContext* context) const OVERRIDE;
118 virtual fileapi::FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE; 117 virtual fileapi::FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE;
119 virtual void DeleteFileSystem( 118 virtual void DeleteFileSystem(
120 const GURL& origin_url, 119 const GURL& origin_url,
121 fileapi::FileSystemType type, 120 fileapi::FileSystemType type,
122 fileapi::FileSystemContext* context, 121 fileapi::FileSystemContext* context,
123 const DeleteFileSystemCallback& callback) OVERRIDE; 122 const DeleteFileSystemCallback& callback) OVERRIDE;
124 123
125 // fileapi::ExternalFileSystemMountPointProvider overrides. 124 // fileapi::ExternalFileSystemBackend overrides.
126 virtual bool IsAccessAllowed(const fileapi::FileSystemURL& url) 125 virtual bool IsAccessAllowed(const fileapi::FileSystemURL& url)
127 const OVERRIDE; 126 const OVERRIDE;
128 virtual std::vector<base::FilePath> GetRootDirectories() const OVERRIDE; 127 virtual std::vector<base::FilePath> GetRootDirectories() const OVERRIDE;
129 virtual void GrantFullAccessToExtension( 128 virtual void GrantFullAccessToExtension(
130 const std::string& extension_id) OVERRIDE; 129 const std::string& extension_id) OVERRIDE;
131 virtual void GrantFileAccessToExtension( 130 virtual void GrantFileAccessToExtension(
132 const std::string& extension_id, 131 const std::string& extension_id,
133 const base::FilePath& virtual_path) OVERRIDE; 132 const base::FilePath& virtual_path) OVERRIDE;
134 virtual void RevokeAccessForExtension( 133 virtual void RevokeAccessForExtension(
135 const std::string& extension_id) OVERRIDE; 134 const std::string& extension_id) OVERRIDE;
(...skipping 16 matching lines...) Expand all
152 // system_mount_points_. Also, mount point paths may overlap with mount point 151 // system_mount_points_. Also, mount point paths may overlap with mount point
153 // paths in system_mount_points_. In both cases mount points in 152 // paths in system_mount_points_. In both cases mount points in
154 // |mount_points_| will have a priority. 153 // |mount_points_| will have a priority.
155 // E.g. if |mount_points_| map 'foo1' to '/foo/foo1' and 154 // E.g. if |mount_points_| map 'foo1' to '/foo/foo1' and
156 // |file_system_mount_points_| map 'xxx' to '/foo/foo1/xxx', |GetVirtualPaths| 155 // |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 156 // will resolve '/foo/foo1/xxx/yyy' as 'foo1/xxx/yyy' (i.e. the mapping from
158 // |mount_points_| will be used). 157 // |mount_points_| will be used).
159 scoped_refptr<fileapi::ExternalMountPoints> mount_points_; 158 scoped_refptr<fileapi::ExternalMountPoints> mount_points_;
160 159
161 // Globally visible mount points. System MountPonts instance should outlive 160 // Globally visible mount points. System MountPonts instance should outlive
162 // all CrosMountPointProvider instances, so raw pointer is safe. 161 // all FileSystemBackend instances, so raw pointer is safe.
163 fileapi::ExternalMountPoints* system_mount_points_; 162 fileapi::ExternalMountPoints* system_mount_points_;
164 163
165 DISALLOW_COPY_AND_ASSIGN(CrosMountPointProvider); 164 DISALLOW_COPY_AND_ASSIGN(FileSystemBackend);
166 }; 165 };
167 166
168 } // namespace chromeos 167 } // namespace chromeos
169 168
170 #endif // CHROME_BROWSER_CHROMEOS_FILEAPI_CROS_MOUNT_POINT_PROVIDER_H_ 169 #endif // CHROME_BROWSER_CHROMEOS_FILEAPI_FILE_SYSTEM_BACKEND_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698