OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef WEBKIT_FILEAPI_MOUNT_POINTS_H_ |
| 6 #define WEBKIT_FILEAPI_MOUNT_POINTS_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/basictypes.h" |
| 12 #include "base/file_path.h" |
| 13 #include "webkit/fileapi/file_system_util.h" |
| 14 #include "webkit/storage/webkit_storage_export.h" |
| 15 |
| 16 class GURL; |
| 17 |
| 18 namespace fileapi { |
| 19 |
| 20 // Represents a set of mount points for File API. |
| 21 class WEBKIT_STORAGE_EXPORT MountPoints { |
| 22 public: |
| 23 struct WEBKIT_STORAGE_EXPORT MountPointInfo { |
| 24 MountPointInfo(); |
| 25 MountPointInfo(const std::string& name, const FilePath& path); |
| 26 |
| 27 // The name to be used to register the path. The registered file can |
| 28 // be referred by a virtual path /<filesystem_id>/<name>. |
| 29 // The name should NOT contain a path separator '/'. |
| 30 std::string name; |
| 31 |
| 32 // The path of the file. |
| 33 FilePath path; |
| 34 |
| 35 // For STL operation. |
| 36 bool operator<(const MountPointInfo& that) const { |
| 37 return name < that.name; |
| 38 } |
| 39 }; |
| 40 |
| 41 MountPoints() {} |
| 42 virtual ~MountPoints() {} |
| 43 |
| 44 // Returns true if the MountPoints implementation can crack FileSystemURL |
| 45 // with given mount type. |
| 46 virtual bool CanCrackMountType(FileSystemType type) const = 0; |
| 47 |
| 48 // Returns the mount point root path registered for a given |mount_name|. |
| 49 // Returns false if the given |mount_name| is not valid. |
| 50 virtual bool GetRegisteredPath(const std::string& mount_name, |
| 51 FilePath* path) const = 0; |
| 52 |
| 53 // TODO(tbarzic): Add CrackURL methods here. |
| 54 |
| 55 // Revokes a mount point identified by |mount_name|. |
| 56 // Returns false if the |mount_name| is not (no longer) registered. |
| 57 // TODO(kinuko): Probably this should be rather named RevokeMountPoint. |
| 58 virtual bool RevokeFileSystem(const std::string& mount_name) = 0; |
| 59 |
| 60 private: |
| 61 DISALLOW_COPY_AND_ASSIGN(MountPoints); |
| 62 }; |
| 63 |
| 64 } // namespace fileapi |
| 65 |
| 66 #endif // WEBKIT_FILEAPI_MOUNT_POINTS_H_ |
OLD | NEW |