// Copyright 2012 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_DRIVE_FILE_ERRORS_H_ #define COMPONENTS_DRIVE_FILE_ERRORS_H_ #include "base/files/file.h" #include "google_apis/common/api_error_codes.h" namespace drive { // These values are persisted to UMA histograms (see UMA enum DriveFileError). // The histogram values are positive (1=OK, 2=FAILED, 3=IN_USE, etc). // Entries should not be renumbered and numeric values should never be reused. // // Consider using `IsFileErrorOk` to check for successful operations, as it // includes both `FILE_ERROR_OK` and `FILE_ERROR_OK_WITH_MORE_RESULTS`. enum FileError { … }; std::ostream& operator<<(std::ostream& out, FileError error); // Returns whether a `FileError` represents a successful operation. bool IsFileErrorOk(FileError error); // Returns a string representation of FileError. std::string FileErrorToString(FileError error); // Returns a base::File::Error that corresponds to the FileError provided. base::File::Error FileErrorToBaseFileError(FileError error); // Converts GData error code into Drive file error code. FileError GDataToFileError(google_apis::ApiErrorCode status); } // namespace drive #endif // COMPONENTS_DRIVE_FILE_ERRORS_H_