| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 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 | 
|  | 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   // Revokes a mount point identified by |mount_name|. | 
|  | 45   // Returns false if the |mount_name| is not (no longer) registered. | 
|  | 46   // TODO(kinuko): Probably this should be rather named RevokeMountPoint. | 
|  | 47   virtual bool RevokeFileSystem(const std::string& mount_name) = 0; | 
|  | 48 | 
|  | 49   // Returns the mount point root path registered for a given |mount_name|. | 
|  | 50   // Returns false if the given |mount_name| is not valid. | 
|  | 51   virtual bool GetRegisteredPath(const std::string& mount_name, | 
|  | 52                                  FilePath* path) const = 0; | 
|  | 53 | 
|  | 54   // Cracks the given |virtual_path| (which is the path part of a filesystem URL | 
|  | 55   // without '/external' or '/isolated' prefix part) and populates the | 
|  | 56   // |mount_name|, |type|, and |path| if the <mount_name> part embedded in | 
|  | 57   // the |virtual_path| (i.e. the first component of the |virtual_path|) is a | 
|  | 58   // valid registered filesystem ID or mount name for an existing mount point. | 
|  | 59   // | 
|  | 60   // Returns false if the given virtual_path cannot be cracked. | 
|  | 61   // | 
|  | 62   // Note that |path| is set to empty paths if the filesystem type is isolated | 
|  | 63   // and |virtual_path| has no <relative_path> part (i.e. pointing to the | 
|  | 64   // virtual root). | 
|  | 65   virtual bool CrackVirtualPath(const FilePath& virtual_path, | 
|  | 66                                 std::string* mount_name, | 
|  | 67                                 FileSystemType* type, | 
|  | 68                                 FilePath* path) const = 0; | 
|  | 69 | 
|  | 70  private: | 
|  | 71   DISALLOW_COPY_AND_ASSIGN(MountPoints); | 
|  | 72 }; | 
|  | 73 | 
|  | 74 }  // namespace fileapi | 
|  | 75 | 
|  | 76 #endif  // WEBKIT_FILEAPI_MOUNT_POINTS_H_ | 
|  | 77 | 
| OLD | NEW | 
|---|