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_COMMON_FILEAPI_FILE_SYSTEM_UTIL_H_ | 5 #ifndef WEBKIT_COMMON_FILEAPI_FILE_SYSTEM_UTIL_H_ |
6 #define WEBKIT_COMMON_FILEAPI_FILE_SYSTEM_UTIL_H_ | 6 #define WEBKIT_COMMON_FILEAPI_FILE_SYSTEM_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
| 11 #include "base/files/file.h" |
11 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
12 #include "base/platform_file.h" | 13 #include "base/platform_file.h" |
13 #include "third_party/WebKit/public/platform/WebFileError.h" | 14 #include "third_party/WebKit/public/platform/WebFileError.h" |
14 #include "third_party/WebKit/public/platform/WebFileSystemType.h" | 15 #include "third_party/WebKit/public/platform/WebFileSystemType.h" |
15 #include "webkit/common/fileapi/file_system_info.h" | 16 #include "webkit/common/fileapi/file_system_info.h" |
16 #include "webkit/common/fileapi/file_system_types.h" | 17 #include "webkit/common/fileapi/file_system_types.h" |
17 #include "webkit/common/quota/quota_types.h" | 18 #include "webkit/common/quota/quota_types.h" |
18 #include "webkit/common/webkit_storage_common_export.h" | 19 #include "webkit/common/webkit_storage_common_export.h" |
19 | 20 |
20 class GURL; | 21 class GURL; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 // third_party/leveldatabase/env_chromium.cc with them. | 123 // third_party/leveldatabase/env_chromium.cc with them. |
123 WEBKIT_STORAGE_COMMON_EXPORT std::string FilePathToString( | 124 WEBKIT_STORAGE_COMMON_EXPORT std::string FilePathToString( |
124 const base::FilePath& file_path); | 125 const base::FilePath& file_path); |
125 | 126 |
126 // Decode a file path from |file_path_string|. | 127 // Decode a file path from |file_path_string|. |
127 WEBKIT_STORAGE_COMMON_EXPORT base::FilePath StringToFilePath( | 128 WEBKIT_STORAGE_COMMON_EXPORT base::FilePath StringToFilePath( |
128 const std::string& file_path_string); | 129 const std::string& file_path_string); |
129 | 130 |
130 // File error conversion | 131 // File error conversion |
131 WEBKIT_STORAGE_COMMON_EXPORT blink::WebFileError | 132 WEBKIT_STORAGE_COMMON_EXPORT blink::WebFileError |
132 PlatformFileErrorToWebFileError(base::PlatformFileError error_code); | 133 FileErrorToWebFileError(base::File::Error error_code); |
133 | 134 |
134 // Generate a file system name for the given arguments. Should only be used by | 135 // Generate a file system name for the given arguments. Should only be used by |
135 // platform apps. | 136 // platform apps. |
136 WEBKIT_STORAGE_COMMON_EXPORT std::string GetIsolatedFileSystemName( | 137 WEBKIT_STORAGE_COMMON_EXPORT std::string GetIsolatedFileSystemName( |
137 const GURL& origin_url, | 138 const GURL& origin_url, |
138 const std::string& filesystem_id); | 139 const std::string& filesystem_id); |
139 | 140 |
140 // Find the file system id from |filesystem_name|. Should only be used by | 141 // Find the file system id from |filesystem_name|. Should only be used by |
141 // platform apps. This function will return false if the file system name is | 142 // platform apps. This function will return false if the file system name is |
142 // not of the form {origin}:Isolated_{id}, and will also check that there is an | 143 // not of the form {origin}:Isolated_{id}, and will also check that there is an |
(...skipping 13 matching lines...) Expand all Loading... |
156 const GURL& origin_url, | 157 const GURL& origin_url, |
157 const std::string& filesystem_id, | 158 const std::string& filesystem_id, |
158 const std::string& optional_root_name); | 159 const std::string& optional_root_name); |
159 | 160 |
160 // Returns the root URI for an external filesystem for origin |origin_url| | 161 // Returns the root URI for an external filesystem for origin |origin_url| |
161 // and |mount_name|. | 162 // and |mount_name|. |
162 WEBKIT_STORAGE_COMMON_EXPORT std::string GetExternalFileSystemRootURIString( | 163 WEBKIT_STORAGE_COMMON_EXPORT std::string GetExternalFileSystemRootURIString( |
163 const GURL& origin_url, | 164 const GURL& origin_url, |
164 const std::string& mount_name); | 165 const std::string& mount_name); |
165 | 166 |
166 // Translates the net::Error to base::PlatformFileError. | 167 // Translates the net::Error to base::File::Error. |
167 WEBKIT_STORAGE_COMMON_EXPORT base::PlatformFileError | 168 WEBKIT_STORAGE_COMMON_EXPORT base::File::Error |
168 NetErrorToPlatformFileError(int error); | 169 NetErrorToFileError(int error); |
169 | 170 |
170 #if defined(OS_CHROMEOS) | 171 #if defined(OS_CHROMEOS) |
171 // Returns the filesystem info that can be specified by |origin_url|. | 172 // Returns the filesystem info that can be specified by |origin_url|. |
172 // TODO(nhiroki): This should be deprecated and use | 173 // TODO(nhiroki): This should be deprecated and use |
173 // GetExternalFileSystemRootURIString() to get separate file systems for each | 174 // GetExternalFileSystemRootURIString() to get separate file systems for each |
174 // mount type. http://crbug.com/284963. | 175 // mount type. http://crbug.com/284963. |
175 WEBKIT_STORAGE_COMMON_EXPORT FileSystemInfo | 176 WEBKIT_STORAGE_COMMON_EXPORT FileSystemInfo |
176 GetFileSystemInfoForChromeOS(const GURL& origin_url); | 177 GetFileSystemInfoForChromeOS(const GURL& origin_url); |
177 #endif | 178 #endif |
178 | 179 |
179 } // namespace fileapi | 180 } // namespace fileapi |
180 | 181 |
181 #endif // WEBKIT_COMMON_FILEAPI_FILE_SYSTEM_UTIL_H_ | 182 #endif // WEBKIT_COMMON_FILEAPI_FILE_SYSTEM_UTIL_H_ |
OLD | NEW |