OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 WEBKIT_BROWSER_FILEAPI_EXTERNAL_MOUNT_POINTS_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_EXTERNAL_MOUNT_POINTS_H_ |
6 #define WEBKIT_BROWSER_FILEAPI_EXTERNAL_MOUNT_POINTS_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_EXTERNAL_MOUNT_POINTS_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/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
14 #include "webkit/browser/fileapi/mount_points.h" | 14 #include "storage/browser/fileapi/mount_points.h" |
15 #include "webkit/browser/webkit_storage_browser_export.h" | 15 #include "storage/common/storage_export.h" |
16 #include "webkit/common/fileapi/file_system_mount_option.h" | 16 #include "storage/common/fileapi/file_system_mount_option.h" |
17 #include "webkit/common/fileapi/file_system_types.h" | 17 #include "storage/common/fileapi/file_system_types.h" |
18 | 18 |
19 namespace base { | 19 namespace base { |
20 class FilePath; | 20 class FilePath; |
21 } | 21 } |
22 | 22 |
23 namespace fileapi { | 23 namespace storage { |
24 | 24 |
25 class FileSystemURL; | 25 class FileSystemURL; |
26 | 26 |
27 // Manages external filesystem namespaces that are identified by 'mount name' | 27 // Manages external filesystem namespaces that are identified by 'mount name' |
28 // and are persisted until RevokeFileSystem is called. | 28 // and are persisted until RevokeFileSystem is called. |
29 // Files in an external filesystem are identified by a filesystem URL like: | 29 // Files in an external filesystem are identified by a filesystem URL like: |
30 // | 30 // |
31 // filesystem:<origin>/external/<mount_name>/relative/path | 31 // filesystem:<origin>/external/<mount_name>/relative/path |
32 // | 32 // |
33 class WEBKIT_STORAGE_BROWSER_EXPORT ExternalMountPoints | 33 class STORAGE_EXPORT ExternalMountPoints |
34 : public base::RefCountedThreadSafe<ExternalMountPoints>, | 34 : public base::RefCountedThreadSafe<ExternalMountPoints>, |
35 public MountPoints { | 35 public MountPoints { |
36 public: | 36 public: |
37 static ExternalMountPoints* GetSystemInstance(); | 37 static ExternalMountPoints* GetSystemInstance(); |
38 static scoped_refptr<ExternalMountPoints> CreateRefCounted(); | 38 static scoped_refptr<ExternalMountPoints> CreateRefCounted(); |
39 | 39 |
40 // Registers a new named external filesystem. | 40 // Registers a new named external filesystem. |
41 // The |path| is registered as the root path of the mount point which | 41 // The |path| is registered as the root path of the mount point which |
42 // is identified by a URL "filesystem:.../external/mount_name". | 42 // is identified by a URL "filesystem:.../external/mount_name". |
43 // | 43 // |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 // If a media gallery and another file system are registered for related | 98 // If a media gallery and another file system are registered for related |
99 // paths, only the other registration is taken into account. | 99 // paths, only the other registration is taken into account. |
100 // | 100 // |
101 // Returned virtual_path will have normalized path separators. | 101 // Returned virtual_path will have normalized path separators. |
102 bool GetVirtualPath(const base::FilePath& absolute_path, | 102 bool GetVirtualPath(const base::FilePath& absolute_path, |
103 base::FilePath* virtual_path) const; | 103 base::FilePath* virtual_path) const; |
104 | 104 |
105 // Returns the virtual root path that looks like /<mount_name>. | 105 // Returns the virtual root path that looks like /<mount_name>. |
106 base::FilePath CreateVirtualRootPath(const std::string& mount_name) const; | 106 base::FilePath CreateVirtualRootPath(const std::string& mount_name) const; |
107 | 107 |
108 FileSystemURL CreateExternalFileSystemURL( | 108 FileSystemURL CreateExternalFileSystemURL(const GURL& origin, |
109 const GURL& origin, | 109 const std::string& mount_name, |
110 const std::string& mount_name, | 110 const base::FilePath& path) const; |
111 const base::FilePath& path) const; | |
112 | 111 |
113 // Revoke all registered filesystems. Used only by testing (for clean-ups). | 112 // Revoke all registered filesystems. Used only by testing (for clean-ups). |
114 void RevokeAllFileSystems(); | 113 void RevokeAllFileSystems(); |
115 | 114 |
116 private: | 115 private: |
117 friend class base::RefCountedThreadSafe<ExternalMountPoints>; | 116 friend class base::RefCountedThreadSafe<ExternalMountPoints>; |
118 | 117 |
119 // Represents each file system instance (defined in the .cc). | 118 // Represents each file system instance (defined in the .cc). |
120 class Instance; | 119 class Instance; |
121 | 120 |
(...skipping 25 matching lines...) Expand all Loading... |
147 | 146 |
148 // This lock needs to be obtained when accessing the instance_map_. | 147 // This lock needs to be obtained when accessing the instance_map_. |
149 mutable base::Lock lock_; | 148 mutable base::Lock lock_; |
150 | 149 |
151 NameToInstance instance_map_; | 150 NameToInstance instance_map_; |
152 PathToName path_to_name_map_; | 151 PathToName path_to_name_map_; |
153 | 152 |
154 DISALLOW_COPY_AND_ASSIGN(ExternalMountPoints); | 153 DISALLOW_COPY_AND_ASSIGN(ExternalMountPoints); |
155 }; | 154 }; |
156 | 155 |
157 } // namespace fileapi | 156 } // namespace storage |
158 | 157 |
159 #endif // WEBKIT_BROWSER_FILEAPI_EXTERNAL_MOUNT_POINTS_H_ | 158 #endif // WEBKIT_BROWSER_FILEAPI_EXTERNAL_MOUNT_POINTS_H_ |
OLD | NEW |