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 #include "webkit/fileapi/file_system_util.h" | 5 #include "webkit/fileapi/file_system_util.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 } | 242 } |
243 | 243 |
244 FilePath StringToFilePath(const std::string& file_path_string) { | 244 FilePath StringToFilePath(const std::string& file_path_string) { |
245 #if defined(OS_WIN) | 245 #if defined(OS_WIN) |
246 return FilePath(UTF8ToUTF16(file_path_string)); | 246 return FilePath(UTF8ToUTF16(file_path_string)); |
247 #elif defined(OS_POSIX) | 247 #elif defined(OS_POSIX) |
248 return FilePath(file_path_string); | 248 return FilePath(file_path_string); |
249 #endif | 249 #endif |
250 } | 250 } |
251 | 251 |
| 252 WebKit::WebFileError PlatformFileErrorToWebFileError( |
| 253 base::PlatformFileError error_code) { |
| 254 switch (error_code) { |
| 255 case base::PLATFORM_FILE_ERROR_NOT_FOUND: |
| 256 return WebKit::WebFileErrorNotFound; |
| 257 case base::PLATFORM_FILE_ERROR_INVALID_OPERATION: |
| 258 case base::PLATFORM_FILE_ERROR_EXISTS: |
| 259 case base::PLATFORM_FILE_ERROR_NOT_EMPTY: |
| 260 return WebKit::WebFileErrorInvalidModification; |
| 261 case base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY: |
| 262 case base::PLATFORM_FILE_ERROR_NOT_A_FILE: |
| 263 return WebKit::WebFileErrorTypeMismatch; |
| 264 case base::PLATFORM_FILE_ERROR_ACCESS_DENIED: |
| 265 return WebKit::WebFileErrorNoModificationAllowed; |
| 266 case base::PLATFORM_FILE_ERROR_FAILED: |
| 267 return WebKit::WebFileErrorInvalidState; |
| 268 case base::PLATFORM_FILE_ERROR_ABORT: |
| 269 return WebKit::WebFileErrorAbort; |
| 270 case base::PLATFORM_FILE_ERROR_SECURITY: |
| 271 return WebKit::WebFileErrorSecurity; |
| 272 case base::PLATFORM_FILE_ERROR_NO_SPACE: |
| 273 return WebKit::WebFileErrorQuotaExceeded; |
| 274 default: |
| 275 return WebKit::WebFileErrorInvalidModification; |
| 276 } |
| 277 } |
| 278 |
252 } // namespace fileapi | 279 } // namespace fileapi |
OLD | NEW |