1// Copyright 2013 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_SYNC_FILE_SYSTEM_SYNC_STATUS_CODE_H_ 6#define CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_STATUS_CODE_H_ 7 8#include <string> 9 10#include "base/platform_file.h" 11 12namespace leveldb { 13class Status; 14} 15 16namespace sync_file_system { 17 18enum SyncStatusCode { 19 SYNC_STATUS_OK = 0, 20 SYNC_STATUS_UNKNOWN = -1000, 21 22 // Generic error code which is not specifically related to a specific 23 // submodule error code (yet). 24 SYNC_STATUS_FAILED = -1001, 25 26 // Basic ones that could be directly mapped to PlatformFileError. 27 SYNC_FILE_ERROR_FAILED = -1, 28 SYNC_FILE_ERROR_IN_USE = -2, 29 SYNC_FILE_ERROR_EXISTS = -3, 30 SYNC_FILE_ERROR_NOT_FOUND = -4, 31 SYNC_FILE_ERROR_ACCESS_DENIED = -5, 32 SYNC_FILE_ERROR_TOO_MANY_OPENED = -6, 33 SYNC_FILE_ERROR_NO_MEMORY = -7, 34 SYNC_FILE_ERROR_NO_SPACE = -8, 35 SYNC_FILE_ERROR_NOT_A_DIRECTORY = -9, 36 SYNC_FILE_ERROR_INVALID_OPERATION = -10, 37 SYNC_FILE_ERROR_SECURITY = -11, 38 SYNC_FILE_ERROR_ABORT = -12, 39 SYNC_FILE_ERROR_NOT_A_FILE = -13, 40 SYNC_FILE_ERROR_NOT_EMPTY = -14, 41 SYNC_FILE_ERROR_INVALID_URL = -15, 42 43 // Database related errors. 44 SYNC_DATABASE_ERROR_NOT_FOUND = -16, 45 SYNC_DATABASE_ERROR_CORRUPTION = -17, 46 SYNC_DATABASE_ERROR_IO_ERROR = -18, 47 SYNC_DATABASE_ERROR_FAILED = -19, 48 49 // Sync specific status code. 50 SYNC_STATUS_FILE_BUSY = -100, 51 SYNC_STATUS_HAS_CONFLICT = -101, 52 SYNC_STATUS_NO_CONFLICT = -102, 53 SYNC_STATUS_ABORT = -103, 54 SYNC_STATUS_NO_CHANGE_TO_SYNC = -104, 55 SYNC_STATUS_RETRY = -105, 56 SYNC_STATUS_NETWORK_ERROR = -106, 57 SYNC_STATUS_AUTHENTICATION_FAILED = -107, 58 SYNC_STATUS_UNKNOWN_ORIGIN = -108, 59 SYNC_STATUS_NOT_MODIFIED = -109, 60 SYNC_STATUS_SYNC_DISABLED = -110, 61 SYNC_STATUS_ACCESS_FORBIDDEN = -111, 62}; 63 64const char* SyncStatusCodeToString(SyncStatusCode status); 65 66SyncStatusCode LevelDBStatusToSyncStatusCode(const leveldb::Status& status); 67 68SyncStatusCode PlatformFileErrorToSyncStatusCode( 69 base::PlatformFileError file_error); 70 71} // namespace sync_file_system 72 73#endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_STATUS_CODE_H_ 74