| Index: chrome/browser/sync_file_system/drive_backend/drive_backend_util.cc
|
| diff --git a/chrome/browser/sync_file_system/drive_backend/drive_backend_util.cc b/chrome/browser/sync_file_system/drive_backend/drive_backend_util.cc
|
| index b6cc71065bf48944687fc222ef0fffe044fb4a25..08a34b24caf7bdce4a00bcc7a7995bcd62ee75b6 100644
|
| --- a/chrome/browser/sync_file_system/drive_backend/drive_backend_util.cc
|
| +++ b/chrome/browser/sync_file_system/drive_backend/drive_backend_util.cc
|
| @@ -12,6 +12,7 @@
|
| #include "chrome/browser/drive/drive_api_util.h"
|
| #include "chrome/browser/sync_file_system/drive_backend/drive_backend_constants.h"
|
| #include "chrome/browser/sync_file_system/drive_backend/metadata_database.pb.h"
|
| +#include "chrome/browser/sync_file_system/logger.h"
|
| #include "google_apis/drive/drive_api_parser.h"
|
| #include "google_apis/drive/gdata_wapi_parser.h"
|
| #include "net/base/mime_util.h"
|
| @@ -184,5 +185,72 @@ scoped_ptr<google_apis::ResourceEntry> GetOldestCreatedFolderResource(
|
| return oldest.Pass();
|
| }
|
|
|
| +SyncStatusCode GDataErrorCodeToSyncStatusCode(
|
| + google_apis::GDataErrorCode error) {
|
| + // NOTE: Please update DriveFileSyncService::UpdateServiceState when you add
|
| + // more error code mapping.
|
| + switch (error) {
|
| + case google_apis::HTTP_SUCCESS:
|
| + case google_apis::HTTP_CREATED:
|
| + case google_apis::HTTP_NO_CONTENT:
|
| + case google_apis::HTTP_FOUND:
|
| + return SYNC_STATUS_OK;
|
| +
|
| + case google_apis::HTTP_NOT_MODIFIED:
|
| + return SYNC_STATUS_NOT_MODIFIED;
|
| +
|
| + case google_apis::HTTP_CONFLICT:
|
| + case google_apis::HTTP_PRECONDITION:
|
| + return SYNC_STATUS_HAS_CONFLICT;
|
| +
|
| + case google_apis::HTTP_UNAUTHORIZED:
|
| + return SYNC_STATUS_AUTHENTICATION_FAILED;
|
| +
|
| + case google_apis::GDATA_NO_CONNECTION:
|
| + return SYNC_STATUS_NETWORK_ERROR;
|
| +
|
| + case google_apis::HTTP_INTERNAL_SERVER_ERROR:
|
| + case google_apis::HTTP_BAD_GATEWAY:
|
| + case google_apis::HTTP_SERVICE_UNAVAILABLE:
|
| + case google_apis::GDATA_CANCELLED:
|
| + case google_apis::GDATA_NOT_READY:
|
| + return SYNC_STATUS_SERVICE_TEMPORARILY_UNAVAILABLE;
|
| +
|
| + case google_apis::HTTP_NOT_FOUND:
|
| + case google_apis::HTTP_GONE:
|
| + return SYNC_FILE_ERROR_NOT_FOUND;
|
| +
|
| + case google_apis::GDATA_FILE_ERROR:
|
| + return SYNC_FILE_ERROR_FAILED;
|
| +
|
| + case google_apis::HTTP_FORBIDDEN:
|
| + return SYNC_STATUS_ACCESS_FORBIDDEN;
|
| +
|
| + case google_apis::HTTP_RESUME_INCOMPLETE:
|
| + case google_apis::HTTP_BAD_REQUEST:
|
| + case google_apis::HTTP_LENGTH_REQUIRED:
|
| + case google_apis::HTTP_NOT_IMPLEMENTED:
|
| + case google_apis::GDATA_PARSE_ERROR:
|
| + case google_apis::GDATA_OTHER_ERROR:
|
| + return SYNC_STATUS_FAILED;
|
| +
|
| + case google_apis::GDATA_NO_SPACE:
|
| + return SYNC_FILE_ERROR_NO_SPACE;
|
| + }
|
| +
|
| + // There's a case where DriveService layer returns GDataErrorCode==-1
|
| + // when network is unavailable. (http://crbug.com/223042)
|
| + // TODO(kinuko,nhiroki): We should identify from where this undefined error
|
| + // code is coming.
|
| + if (error == -1)
|
| + return SYNC_STATUS_NETWORK_ERROR;
|
| +
|
| + util::Log(logging::LOG_WARNING,
|
| + FROM_HERE,
|
| + "Got unexpected error: %d",
|
| + static_cast<int>(error));
|
| + return SYNC_STATUS_FAILED;
|
| +}
|
| +
|
| } // namespace drive_backend
|
| } // namespace sync_file_system
|
|
|