| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_FILE_SYSTEM_URL_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_URL_H_ |
| 6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_URL_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_URL_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/platform_file.h" | 11 #include "base/platform_file.h" |
| 12 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
| 13 #include "webkit/browser/webkit_storage_browser_export.h" |
| 13 #include "webkit/common/fileapi/file_system_types.h" | 14 #include "webkit/common/fileapi/file_system_types.h" |
| 14 #include "webkit/storage/webkit_storage_export.h" | |
| 15 | 15 |
| 16 namespace fileapi { | 16 namespace fileapi { |
| 17 | 17 |
| 18 // A class representing a filesystem URL which consists of origin URL, | 18 // A class representing a filesystem URL which consists of origin URL, |
| 19 // type and an internal path used inside the filesystem. | 19 // type and an internal path used inside the filesystem. |
| 20 // | 20 // |
| 21 // When a FileSystemURL instance is created for a GURL (for filesystem: scheme), | 21 // When a FileSystemURL instance is created for a GURL (for filesystem: scheme), |
| 22 // each accessor method would return following values: | 22 // each accessor method would return following values: |
| 23 // | 23 // |
| 24 // Example: For a URL 'filesystem:http://foo.com/temporary/foo/bar': | 24 // Example: For a URL 'filesystem:http://foo.com/temporary/foo/bar': |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 // <Friend>::CrackURL, <Friend>::CreateCrackedFileSystemURL, where <Friend> is | 67 // <Friend>::CrackURL, <Friend>::CreateCrackedFileSystemURL, where <Friend> is |
| 68 // one of the friended classes. | 68 // one of the friended classes. |
| 69 // | 69 // |
| 70 // TODO(ericu): Look into making virtual_path() [and all FileSystem API virtual | 70 // TODO(ericu): Look into making virtual_path() [and all FileSystem API virtual |
| 71 // paths] just an std::string, to prevent platform-specific base::FilePath | 71 // paths] just an std::string, to prevent platform-specific base::FilePath |
| 72 // behavior from getting invoked by accident. Currently the base::FilePath | 72 // behavior from getting invoked by accident. Currently the base::FilePath |
| 73 // returned here needs special treatment, as it may contain paths that are | 73 // returned here needs special treatment, as it may contain paths that are |
| 74 // illegal on the current platform. | 74 // illegal on the current platform. |
| 75 // To avoid problems, use VirtualPath::BaseName and | 75 // To avoid problems, use VirtualPath::BaseName and |
| 76 // VirtualPath::GetComponents instead of the base::FilePath methods. | 76 // VirtualPath::GetComponents instead of the base::FilePath methods. |
| 77 class WEBKIT_STORAGE_EXPORT FileSystemURL { | 77 class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemURL { |
| 78 public: | 78 public: |
| 79 FileSystemURL(); | 79 FileSystemURL(); |
| 80 ~FileSystemURL(); | 80 ~FileSystemURL(); |
| 81 | 81 |
| 82 // Methods for creating FileSystemURL without attempting to crack them. | 82 // Methods for creating FileSystemURL without attempting to crack them. |
| 83 // Should be used only in tests. | 83 // Should be used only in tests. |
| 84 static FileSystemURL CreateForTest(const GURL& url); | 84 static FileSystemURL CreateForTest(const GURL& url); |
| 85 static FileSystemURL CreateForTest(const GURL& origin, | 85 static FileSystemURL CreateForTest(const GURL& origin, |
| 86 FileSystemType mount_type, | 86 FileSystemType mount_type, |
| 87 const base::FilePath& virtual_path); | 87 const base::FilePath& virtual_path); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 120 |
| 121 std::string DebugString() const; | 121 std::string DebugString() const; |
| 122 | 122 |
| 123 // Returns true if this URL is a strict parent of the |child|. | 123 // Returns true if this URL is a strict parent of the |child|. |
| 124 bool IsParent(const FileSystemURL& child) const; | 124 bool IsParent(const FileSystemURL& child) const; |
| 125 | 125 |
| 126 bool IsInSameFileSystem(const FileSystemURL& other) const; | 126 bool IsInSameFileSystem(const FileSystemURL& other) const; |
| 127 | 127 |
| 128 bool operator==(const FileSystemURL& that) const; | 128 bool operator==(const FileSystemURL& that) const; |
| 129 | 129 |
| 130 struct WEBKIT_STORAGE_EXPORT Comparator { | 130 struct WEBKIT_STORAGE_BROWSER_EXPORT Comparator { |
| 131 bool operator() (const FileSystemURL& lhs, const FileSystemURL& rhs) const; | 131 bool operator() (const FileSystemURL& lhs, const FileSystemURL& rhs) const; |
| 132 }; | 132 }; |
| 133 | 133 |
| 134 private: | 134 private: |
| 135 friend class FileSystemContext; | 135 friend class FileSystemContext; |
| 136 friend class ExternalMountPoints; | 136 friend class ExternalMountPoints; |
| 137 friend class IsolatedContext; | 137 friend class IsolatedContext; |
| 138 | 138 |
| 139 explicit FileSystemURL(const GURL& filesystem_url); | 139 explicit FileSystemURL(const GURL& filesystem_url); |
| 140 FileSystemURL(const GURL& origin, | 140 FileSystemURL(const GURL& origin, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 165 FileSystemType type_; | 165 FileSystemType type_; |
| 166 base::FilePath path_; | 166 base::FilePath path_; |
| 167 std::string filesystem_id_; | 167 std::string filesystem_id_; |
| 168 }; | 168 }; |
| 169 | 169 |
| 170 typedef std::set<FileSystemURL, FileSystemURL::Comparator> FileSystemURLSet; | 170 typedef std::set<FileSystemURL, FileSystemURL::Comparator> FileSystemURLSet; |
| 171 | 171 |
| 172 } // namespace fileapi | 172 } // namespace fileapi |
| 173 | 173 |
| 174 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_URL_H_ | 174 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_URL_H_ |
| OLD | NEW |