Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6362)

Unified Diff: chrome/browser/sync_file_system/drive_file_sync_service.cc

Issue 11416279: Return AUTHENTICATION_FAILED error if Drive operation has failed and user is not signed in (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sync_file_system/drive_file_sync_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync_file_system/drive_file_sync_service.cc
diff --git a/chrome/browser/sync_file_system/drive_file_sync_service.cc b/chrome/browser/sync_file_system/drive_file_sync_service.cc
index 3ad2862e5cf19718f0f23721e1861b82a58f569a..fa49969163c897d8a49f7d2b343360284b340161 100644
--- a/chrome/browser/sync_file_system/drive_file_sync_service.cc
+++ b/chrome/browser/sync_file_system/drive_file_sync_service.cc
@@ -662,7 +662,7 @@ void DriveFileSyncService::DidGetSyncRootDirectory(
const fileapi::SyncStatusCallback& callback,
google_apis::GDataErrorCode error,
const std::string& resource_id) {
- fileapi::SyncStatusCode status = GDataErrorCodeToSyncStatusCode(error);
+ fileapi::SyncStatusCode status = GDataErrorCodeToSyncStatusCodeWrapper(error);
if (error != google_apis::HTTP_SUCCESS &&
error != google_apis::HTTP_CREATED) {
NotifyTaskDone(status, token.Pass());
@@ -711,7 +711,8 @@ void DriveFileSyncService::DidGetDirectoryForOrigin(
const std::string& resource_id) {
if (error != google_apis::HTTP_SUCCESS &&
error != google_apis::HTTP_CREATED) {
- fileapi::SyncStatusCode status = GDataErrorCodeToSyncStatusCode(error);
+ fileapi::SyncStatusCode status =
+ GDataErrorCodeToSyncStatusCodeWrapper(error);
NotifyTaskDone(status, token.Pass());
callback.Run(status);
return;
@@ -734,7 +735,7 @@ void DriveFileSyncService::DidGetLargestChangeStampForBatchSync(
if (error != google_apis::HTTP_SUCCESS) {
pending_batch_sync_origins_.insert(origin);
// TODO(tzik): Refine this error code.
- NotifyTaskDone(GDataErrorCodeToSyncStatusCode(error), token.Pass());
+ NotifyTaskDone(GDataErrorCodeToSyncStatusCodeWrapper(error), token.Pass());
return;
}
@@ -756,7 +757,7 @@ void DriveFileSyncService::DidGetDirectoryContentForBatchSync(
if (error != google_apis::HTTP_SUCCESS) {
pending_batch_sync_origins_.insert(origin);
// TODO(tzik): Refine this error code.
- NotifyTaskDone(GDataErrorCodeToSyncStatusCode(error), token.Pass());
+ NotifyTaskDone(GDataErrorCodeToSyncStatusCodeWrapper(error), token.Pass());
return;
}
@@ -797,7 +798,7 @@ void DriveFileSyncService::DidGetRemoteFileMetadata(
file_type = fileapi::SYNC_FILE_TYPE_FILE;
else if (entry->is_folder())
file_type = fileapi::SYNC_FILE_TYPE_DIRECTORY;
- callback.Run(GDataErrorCodeToSyncStatusCode(error),
+ callback.Run(GDataErrorCodeToSyncStatusCodeWrapper(error),
fileapi::SyncFileMetadata(file_type,
entry->file_size(),
entry->updated_time()));
@@ -869,8 +870,8 @@ void DriveFileSyncService::DidApplyLocalChange(
fileapi::SyncStatusCode status) {
if (status == fileapi::SYNC_STATUS_OK) {
CancelRemoteChange(url);
- NotifyTaskDone(GDataErrorCodeToSyncStatusCode(error), token.Pass());
- callback.Run(GDataErrorCodeToSyncStatusCode(error));
+ NotifyTaskDone(GDataErrorCodeToSyncStatusCodeWrapper(error), token.Pass());
+ callback.Run(GDataErrorCodeToSyncStatusCodeWrapper(error));
return;
}
NotifyTaskDone(status, token.Pass());
@@ -896,7 +897,8 @@ void DriveFileSyncService::DidUploadNewFile(
AsWeakPtr(), base::Passed(&token), url, error, callback));
return;
}
- const fileapi::SyncStatusCode status = GDataErrorCodeToSyncStatusCode(error);
+ const fileapi::SyncStatusCode status =
+ GDataErrorCodeToSyncStatusCodeWrapper(error);
NotifyTaskDone(status, token.Pass());
callback.Run(status);
}
@@ -939,7 +941,7 @@ void DriveFileSyncService::DidUploadExistingFile(
}
default: {
const fileapi::SyncStatusCode status =
- GDataErrorCodeToSyncStatusCode(error);
+ GDataErrorCodeToSyncStatusCodeWrapper(error);
DCHECK_NE(fileapi::SYNC_STATUS_OK, status);
DidApplyLocalChange(token.Pass(), url, error, callback, status);
return;
@@ -973,7 +975,7 @@ void DriveFileSyncService::DidDeleteFile(
}
default: {
const fileapi::SyncStatusCode status =
- GDataErrorCodeToSyncStatusCode(error);
+ GDataErrorCodeToSyncStatusCodeWrapper(error);
DCHECK_NE(fileapi::SYNC_STATUS_OK, status);
DidApplyLocalChange(token.Pass(), url, error, callback, status);
return;
@@ -1143,7 +1145,7 @@ void DriveFileSyncService::DidDownloadFile(
return;
}
- fileapi::SyncStatusCode status = GDataErrorCodeToSyncStatusCode(error);
+ fileapi::SyncStatusCode status = GDataErrorCodeToSyncStatusCodeWrapper(error);
if (status != fileapi::SYNC_STATUS_OK) {
AbortRemoteSync(param.Pass(), status);
return;
@@ -1324,4 +1326,13 @@ bool DriveFileSyncService::GetPendingChangeForFileSystemURL(
return true;
}
+fileapi::SyncStatusCode
+DriveFileSyncService::GDataErrorCodeToSyncStatusCodeWrapper(
+ google_apis::GDataErrorCode error) const {
+ fileapi::SyncStatusCode status = GDataErrorCodeToSyncStatusCode(error);
+ if (status != fileapi::SYNC_STATUS_OK && !sync_client_->IsAuthenticated())
+ return fileapi::SYNC_STATUS_AUTHENTICATION_FAILED;
+ return status;
+}
+
} // namespace sync_file_system
« no previous file with comments | « chrome/browser/sync_file_system/drive_file_sync_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698