file_errors.h revision c2e0dbddbe15c98d52c4786dac06cb8952a8ae6d
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" 10 11namespace drive { 12 13enum FileError { 14 FILE_ERROR_OK = 0, 15 FILE_ERROR_FAILED = -1, 16 FILE_ERROR_IN_USE = -2, 17 FILE_ERROR_EXISTS = -3, 18 FILE_ERROR_NOT_FOUND = -4, 19 FILE_ERROR_ACCESS_DENIED = -5, 20 FILE_ERROR_TOO_MANY_OPENED = -6, 21 FILE_ERROR_NO_MEMORY = -7, 22 FILE_ERROR_NO_SPACE = -8, 23 FILE_ERROR_NOT_A_DIRECTORY = -9, 24 FILE_ERROR_INVALID_OPERATION = -10, 25 FILE_ERROR_SECURITY = -11, 26 FILE_ERROR_ABORT = -12, 27 FILE_ERROR_NOT_A_FILE = -13, 28 FILE_ERROR_NOT_EMPTY = -14, 29 FILE_ERROR_INVALID_URL = -15, 30 FILE_ERROR_NO_CONNECTION = -16, 31 FILE_ERROR_THROTTLED = -17, 32}; 33 34// Used as callbacks for file operations. 35typedef base::Callback<void(FileError error)> FileOperationCallback; 36 37// Returns a string representation of FileError. 38std::string FileErrorToString(FileError error); 39 40// Returns a PlatformFileError that corresponds to the FileError provided. 41base::PlatformFileError FileErrorToPlatformError(FileError error); 42 43} // namespace drive 44 45#endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_ERRORS_H_ 46