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/fileapi/file_system_types.h" | 13 #include "webkit/common/fileapi/file_system_types.h" |
14 #include "webkit/storage/webkit_storage_export.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 // |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 // Additionally, following accessors would return valid values: | 61 // Additionally, following accessors would return valid values: |
62 // filesystem_id() returns 'mount_name'. | 62 // filesystem_id() returns 'mount_name'. |
63 // | 63 // |
64 // It is impossible to directly create a valid FileSystemURL instance (except by | 64 // It is impossible to directly create a valid FileSystemURL instance (except by |
65 // using CreatedForTest methods, which should not be used in production code). | 65 // using CreatedForTest methods, which should not be used in production code). |
66 // To get a valid FileSystemURL, one of the following methods can be used: | 66 // To get a valid FileSystemURL, one of the following methods can be used: |
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 behav
ior | 71 // paths] just an std::string, to prevent platform-specific base::FilePath |
72 // from getting invoked by accident. Currently the base::FilePath returned here
needs | 72 // behavior from getting invoked by accident. Currently the base::FilePath |
73 // special treatment, as it may contain paths that are illegal on the current | 73 // returned here needs special treatment, as it may contain paths that are |
74 // platform. To avoid problems, use VirtualPath::BaseName and | 74 // illegal on the current platform. |
| 75 // To avoid problems, use VirtualPath::BaseName and |
75 // VirtualPath::GetComponents instead of the base::FilePath methods. | 76 // VirtualPath::GetComponents instead of the base::FilePath methods. |
76 class WEBKIT_STORAGE_EXPORT FileSystemURL { | 77 class WEBKIT_STORAGE_EXPORT FileSystemURL { |
77 public: | 78 public: |
78 FileSystemURL(); | 79 FileSystemURL(); |
79 ~FileSystemURL(); | 80 ~FileSystemURL(); |
80 | 81 |
81 // Methods for creating FileSystemURL without attempting to crack them. | 82 // Methods for creating FileSystemURL without attempting to crack them. |
82 // Should be used only in tests. | 83 // Should be used only in tests. |
83 static FileSystemURL CreateForTest(const GURL& url); | 84 static FileSystemURL CreateForTest(const GURL& url); |
84 static FileSystemURL CreateForTest(const GURL& origin, | 85 static FileSystemURL CreateForTest(const GURL& origin, |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 FileSystemType type_; | 165 FileSystemType type_; |
165 base::FilePath path_; | 166 base::FilePath path_; |
166 std::string filesystem_id_; | 167 std::string filesystem_id_; |
167 }; | 168 }; |
168 | 169 |
169 typedef std::set<FileSystemURL, FileSystemURL::Comparator> FileSystemURLSet; | 170 typedef std::set<FileSystemURL, FileSystemURL::Comparator> FileSystemURLSet; |
170 | 171 |
171 } // namespace fileapi | 172 } // namespace fileapi |
172 | 173 |
173 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_URL_H_ | 174 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_URL_H_ |
OLD | NEW |