OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/sync_file_system/drive_file_sync_service.h" | 5 #include "chrome/browser/sync_file_system/drive_file_sync_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 return state_; | 429 return state_; |
430 } | 430 } |
431 | 431 |
432 const char* DriveFileSyncService::GetServiceName() const { | 432 const char* DriveFileSyncService::GetServiceName() const { |
433 return kServiceName; | 433 return kServiceName; |
434 } | 434 } |
435 | 435 |
436 void DriveFileSyncService::ApplyLocalChange( | 436 void DriveFileSyncService::ApplyLocalChange( |
437 const fileapi::FileChange& local_file_change, | 437 const fileapi::FileChange& local_file_change, |
438 const FilePath& local_file_path, | 438 const FilePath& local_file_path, |
439 const fileapi::SyncFileMetadata& local_file_metadata, | |
440 const fileapi::FileSystemURL& url, | 439 const fileapi::FileSystemURL& url, |
441 const fileapi::SyncStatusCallback& callback) { | 440 const fileapi::SyncStatusCallback& callback) { |
442 // TODO(nhiroki): support directory operations (http://crbug.com/161442). | 441 // TODO(nhiroki): support directory operations (http://crbug.com/161442). |
443 DCHECK(!local_file_change.IsDirectory()); | 442 DCHECK(!local_file_change.IsDirectory()); |
444 | 443 |
445 scoped_ptr<TaskToken> token(GetToken( | 444 scoped_ptr<TaskToken> token(GetToken( |
446 FROM_HERE, TASK_TYPE_DATABASE, "Apply local change")); | 445 FROM_HERE, TASK_TYPE_DATABASE, "Apply local change")); |
447 if (!token) { | 446 if (!token) { |
448 pending_tasks_.push_back(base::Bind( | 447 pending_tasks_.push_back(base::Bind( |
449 &DriveFileSyncService::ApplyLocalChange, | 448 &DriveFileSyncService::ApplyLocalChange, |
450 AsWeakPtr(), local_file_change, local_file_path, | 449 AsWeakPtr(), local_file_change, local_file_path, url, callback)); |
451 local_file_metadata, url, callback)); | |
452 return; | 450 return; |
453 } | 451 } |
454 | 452 |
455 if (state_ == REMOTE_SERVICE_DISABLED) { | 453 if (state_ == REMOTE_SERVICE_DISABLED) { |
456 token->ResetTask(FROM_HERE); | 454 token->ResetTask(FROM_HERE); |
457 FinalizeLocalSync(token.Pass(), callback, last_operation_status_); | 455 FinalizeLocalSync(token.Pass(), callback, last_operation_status_); |
458 return; | 456 return; |
459 } | 457 } |
460 | 458 |
461 DriveFileSyncService::LocalSyncOperationType operation = | 459 DriveFileSyncService::LocalSyncOperationType operation = |
(...skipping 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1694 fileapi::SyncStatusCode | 1692 fileapi::SyncStatusCode |
1695 DriveFileSyncService::GDataErrorCodeToSyncStatusCodeWrapper( | 1693 DriveFileSyncService::GDataErrorCodeToSyncStatusCodeWrapper( |
1696 google_apis::GDataErrorCode error) const { | 1694 google_apis::GDataErrorCode error) const { |
1697 fileapi::SyncStatusCode status = GDataErrorCodeToSyncStatusCode(error); | 1695 fileapi::SyncStatusCode status = GDataErrorCodeToSyncStatusCode(error); |
1698 if (status != fileapi::SYNC_STATUS_OK && !sync_client_->IsAuthenticated()) | 1696 if (status != fileapi::SYNC_STATUS_OK && !sync_client_->IsAuthenticated()) |
1699 return fileapi::SYNC_STATUS_AUTHENTICATION_FAILED; | 1697 return fileapi::SYNC_STATUS_AUTHENTICATION_FAILED; |
1700 return status; | 1698 return status; |
1701 } | 1699 } |
1702 | 1700 |
1703 } // namespace sync_file_system | 1701 } // namespace sync_file_system |
OLD | NEW |