blob: 242a247465996c1d8deea85c3fdc9bb01c148792 [file] [log] [blame]
[email protected]78a158b2013-04-23 06:57:491// 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
lukasza76b4a982015-08-08 00:36:395#ifndef COMPONENTS_DRIVE_FILE_ERRORS_H_
6#define COMPONENTS_DRIVE_FILE_ERRORS_H_
[email protected]78a158b2013-04-23 06:57:497
8#include "base/callback_forward.h"
[email protected]141bcc52014-01-27 21:36:009#include "base/files/file.h"
satorux1e04b422015-01-29 07:50:5310#include "google_apis/drive/drive_api_error_codes.h"
[email protected]78a158b2013-04-23 06:57:4911
12namespace drive {
13
14enum 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]f18102152013-08-01 11:58:2923 FILE_ERROR_NO_SERVER_SPACE = -8,
[email protected]78a158b2013-04-23 06:57:4924 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]f18102152013-08-01 11:58:2932 FILE_ERROR_NO_LOCAL_SPACE = -17,
[email protected]9432bc32013-08-08 22:42:5533 FILE_ERROR_SERVICE_UNAVAILABLE = -18,
[email protected]78a158b2013-04-23 06:57:4934};
35
36// Used as callbacks for file operations.
37typedef base::Callback<void(FileError error)> FileOperationCallback;
38
39// Returns a string representation of FileError.
40std::string FileErrorToString(FileError error);
41
[email protected]141bcc52014-01-27 21:36:0042// Returns a base::File::Error that corresponds to the FileError provided.
43base::File::Error FileErrorToBaseFileError(FileError error);
[email protected]78a158b2013-04-23 06:57:4944
[email protected]986582a2013-07-31 06:59:0345// Converts GData error code into Drive file error code.
satorux1e04b422015-01-29 07:50:5346FileError GDataToFileError(google_apis::DriveApiErrorCode status);
[email protected]986582a2013-07-31 06:59:0347
[email protected]78a158b2013-04-23 06:57:4948} // namespace drive
49
lukasza76b4a982015-08-08 00:36:3950#endif // COMPONENTS_DRIVE_FILE_ERRORS_H_