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/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
13 #include "webkit/browser/webkit_storage_browser_export.h" | 13 #include "webkit/browser/storage_export.h" |
14 #include "webkit/common/fileapi/file_system_mount_option.h" | 14 #include "webkit/common/fileapi/file_system_mount_option.h" |
15 #include "webkit/common/fileapi/file_system_types.h" | 15 #include "webkit/common/fileapi/file_system_types.h" |
16 | 16 |
17 namespace storage { | 17 namespace storage { |
18 | 18 |
19 // A class representing a filesystem URL which consists of origin URL, | 19 // A class representing a filesystem URL which consists of origin URL, |
20 // type and an internal path used inside the filesystem. | 20 // type and an internal path used inside the filesystem. |
21 // | 21 // |
22 // When a FileSystemURL instance is created for a GURL (for filesystem: scheme), | 22 // When a FileSystemURL instance is created for a GURL (for filesystem: scheme), |
23 // each accessor method would return following values: | 23 // each accessor method would return following values: |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 // <Friend>::CrackURL, <Friend>::CreateCrackedFileSystemURL, where <Friend> is | 68 // <Friend>::CrackURL, <Friend>::CreateCrackedFileSystemURL, where <Friend> is |
69 // one of the friended classes. | 69 // one of the friended classes. |
70 // | 70 // |
71 // TODO(ericu): Look into making virtual_path() [and all FileSystem API virtual | 71 // TODO(ericu): Look into making virtual_path() [and all FileSystem API virtual |
72 // paths] just an std::string, to prevent platform-specific base::FilePath | 72 // paths] just an std::string, to prevent platform-specific base::FilePath |
73 // behavior from getting invoked by accident. Currently the base::FilePath | 73 // behavior from getting invoked by accident. Currently the base::FilePath |
74 // returned here needs special treatment, as it may contain paths that are | 74 // returned here needs special treatment, as it may contain paths that are |
75 // illegal on the current platform. | 75 // illegal on the current platform. |
76 // To avoid problems, use VirtualPath::BaseName and | 76 // To avoid problems, use VirtualPath::BaseName and |
77 // VirtualPath::GetComponents instead of the base::FilePath methods. | 77 // VirtualPath::GetComponents instead of the base::FilePath methods. |
78 class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemURL { | 78 class STORAGE_EXPORT FileSystemURL { |
79 public: | 79 public: |
80 FileSystemURL(); | 80 FileSystemURL(); |
81 ~FileSystemURL(); | 81 ~FileSystemURL(); |
82 | 82 |
83 // Methods for creating FileSystemURL without attempting to crack them. | 83 // Methods for creating FileSystemURL without attempting to crack them. |
84 // Should be used only in tests. | 84 // Should be used only in tests. |
85 static FileSystemURL CreateForTest(const GURL& url); | 85 static FileSystemURL CreateForTest(const GURL& url); |
86 static FileSystemURL CreateForTest(const GURL& origin, | 86 static FileSystemURL CreateForTest(const GURL& origin, |
87 FileSystemType mount_type, | 87 FileSystemType mount_type, |
88 const base::FilePath& virtual_path); | 88 const base::FilePath& virtual_path); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 bool operator!=(const FileSystemURL& that) const { | 130 bool operator!=(const FileSystemURL& that) const { |
131 return !(*this == that); | 131 return !(*this == that); |
132 } | 132 } |
133 | 133 |
134 struct WEBKIT_STORAGE_BROWSER_EXPORT Comparator { | 134 struct STORAGE_EXPORT Comparator { |
135 bool operator() (const FileSystemURL& lhs, const FileSystemURL& rhs) const; | 135 bool operator() (const FileSystemURL& lhs, const FileSystemURL& rhs) const; |
136 }; | 136 }; |
137 | 137 |
138 private: | 138 private: |
139 friend class FileSystemContext; | 139 friend class FileSystemContext; |
140 friend class ExternalMountPoints; | 140 friend class ExternalMountPoints; |
141 friend class IsolatedContext; | 141 friend class IsolatedContext; |
142 | 142 |
143 explicit FileSystemURL(const GURL& filesystem_url); | 143 explicit FileSystemURL(const GURL& filesystem_url); |
144 FileSystemURL(const GURL& origin, | 144 FileSystemURL(const GURL& origin, |
(...skipping 26 matching lines...) Expand all Loading... |
171 base::FilePath path_; | 171 base::FilePath path_; |
172 std::string filesystem_id_; | 172 std::string filesystem_id_; |
173 FileSystemMountOption mount_option_; | 173 FileSystemMountOption mount_option_; |
174 }; | 174 }; |
175 | 175 |
176 typedef std::set<FileSystemURL, FileSystemURL::Comparator> FileSystemURLSet; | 176 typedef std::set<FileSystemURL, FileSystemURL::Comparator> FileSystemURLSet; |
177 | 177 |
178 } // namespace storage | 178 } // namespace storage |
179 | 179 |
180 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_URL_H_ | 180 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_URL_H_ |
OLD | NEW |