[email protected] | 78a158b | 2013-04-23 06:57:49 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_ERRORS_H_ |
| 6 | #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_ERRORS_H_ |
| 7 | |
| 8 | #include "base/callback_forward.h" |
| 9 | #include "base/platform_file.h" |
[email protected] | e196bef3 | 2013-12-03 05:33:13 | [diff] [blame] | 10 | #include "google_apis/drive/gdata_errorcode.h" |
[email protected] | 78a158b | 2013-04-23 06:57:49 | [diff] [blame] | 11 | |
| 12 | namespace drive { |
| 13 | |
| 14 | enum FileError { |
| 15 | FILE_ERROR_OK = 0, |
| 16 | FILE_ERROR_FAILED = -1, |
| 17 | FILE_ERROR_IN_USE = -2, |
| 18 | FILE_ERROR_EXISTS = -3, |
| 19 | FILE_ERROR_NOT_FOUND = -4, |
| 20 | FILE_ERROR_ACCESS_DENIED = -5, |
| 21 | FILE_ERROR_TOO_MANY_OPENED = -6, |
| 22 | FILE_ERROR_NO_MEMORY = -7, |
[email protected] | f1810215 | 2013-08-01 11:58:29 | [diff] [blame] | 23 | FILE_ERROR_NO_SERVER_SPACE = -8, |
[email protected] | 78a158b | 2013-04-23 06:57:49 | [diff] [blame] | 24 | FILE_ERROR_NOT_A_DIRECTORY = -9, |
| 25 | FILE_ERROR_INVALID_OPERATION = -10, |
| 26 | FILE_ERROR_SECURITY = -11, |
| 27 | FILE_ERROR_ABORT = -12, |
| 28 | FILE_ERROR_NOT_A_FILE = -13, |
| 29 | FILE_ERROR_NOT_EMPTY = -14, |
| 30 | FILE_ERROR_INVALID_URL = -15, |
| 31 | FILE_ERROR_NO_CONNECTION = -16, |
[email protected] | f1810215 | 2013-08-01 11:58:29 | [diff] [blame] | 32 | FILE_ERROR_NO_LOCAL_SPACE = -17, |
[email protected] | 9432bc3 | 2013-08-08 22:42:55 | [diff] [blame] | 33 | FILE_ERROR_SERVICE_UNAVAILABLE = -18, |
[email protected] | 78a158b | 2013-04-23 06:57:49 | [diff] [blame] | 34 | }; |
| 35 | |
| 36 | // Used as callbacks for file operations. |
| 37 | typedef base::Callback<void(FileError error)> FileOperationCallback; |
| 38 | |
| 39 | // Returns a string representation of FileError. |
| 40 | std::string FileErrorToString(FileError error); |
| 41 | |
| 42 | // Returns a PlatformFileError that corresponds to the FileError provided. |
| 43 | base::PlatformFileError FileErrorToPlatformError(FileError error); |
| 44 | |
[email protected] | 986582a | 2013-07-31 06:59:03 | [diff] [blame] | 45 | // Converts GData error code into Drive file error code. |
| 46 | FileError GDataToFileError(google_apis::GDataErrorCode status); |
| 47 | |
[email protected] | 78a158b | 2013-04-23 06:57:49 | [diff] [blame] | 48 | } // namespace drive |
| 49 | |
| 50 | #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_ERRORS_H_ |