| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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_backend/uninstall_app_task.h" | 5 #include "chrome/browser/sync_file_system/drive_backend/uninstall_app_task.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "chrome/browser/drive/drive_api_util.h" | 9 #include "chrome/browser/drive/drive_api_util.h" |
| 10 #include "chrome/browser/drive/drive_service_interface.h" | 10 #include "chrome/browser/drive/drive_service_interface.h" |
| 11 #include "chrome/browser/sync_file_system/drive_backend/drive_backend_constants.
h" | 11 #include "chrome/browser/sync_file_system/drive_backend/drive_backend_constants.
h" |
| 12 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.h" | 12 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.h" |
| 13 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.pb.h" | 13 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.pb.h" |
| 14 #include "chrome/browser/sync_file_system/drive_backend/sync_engine_context.h" | 14 #include "chrome/browser/sync_file_system/drive_backend/sync_engine_context.h" |
| 15 #include "chrome/browser/sync_file_system/drive_backend/tracker_set.h" | 15 #include "chrome/browser/sync_file_system/drive_backend/tracker_set.h" |
| 16 #include "chrome/browser/sync_file_system/drive_backend_v1/drive_file_sync_util.
h" |
| 16 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" | 17 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" |
| 17 #include "google_apis/drive/drive_api_parser.h" | 18 #include "google_apis/drive/drive_api_parser.h" |
| 18 #include "google_apis/drive/gdata_wapi_parser.h" | 19 #include "google_apis/drive/gdata_wapi_parser.h" |
| 19 | 20 |
| 20 namespace sync_file_system { | 21 namespace sync_file_system { |
| 21 namespace drive_backend { | 22 namespace drive_backend { |
| 22 | 23 |
| 23 UninstallAppTask::UninstallAppTask(SyncEngineContext* sync_context, | 24 UninstallAppTask::UninstallAppTask(SyncEngineContext* sync_context, |
| 24 const std::string& app_id, | 25 const std::string& app_id, |
| 25 UninstallFlag uninstall_flag) | 26 UninstallFlag uninstall_flag) |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 std::string(), // etag | 64 std::string(), // etag |
| 64 base::Bind(&UninstallAppTask::DidDeleteAppRoot, | 65 base::Bind(&UninstallAppTask::DidDeleteAppRoot, |
| 65 weak_ptr_factory_.GetWeakPtr(), | 66 weak_ptr_factory_.GetWeakPtr(), |
| 66 callback, | 67 callback, |
| 67 metadata_database()->GetLargestKnownChangeID())); | 68 metadata_database()->GetLargestKnownChangeID())); |
| 68 } | 69 } |
| 69 | 70 |
| 70 void UninstallAppTask::DidDeleteAppRoot(const SyncStatusCallback& callback, | 71 void UninstallAppTask::DidDeleteAppRoot(const SyncStatusCallback& callback, |
| 71 int64 change_id, | 72 int64 change_id, |
| 72 google_apis::GDataErrorCode error) { | 73 google_apis::GDataErrorCode error) { |
| 73 if (error != google_apis::HTTP_SUCCESS && | 74 SyncStatusCode status = GDataErrorCodeToSyncStatusCode(error); |
| 75 if (status != SYNC_STATUS_OK && |
| 74 error != google_apis::HTTP_NOT_FOUND) { | 76 error != google_apis::HTTP_NOT_FOUND) { |
| 75 callback.Run(SYNC_STATUS_FAILED); | 77 callback.Run(SYNC_STATUS_FAILED); |
| 76 return; | 78 return; |
| 77 } | 79 } |
| 78 | 80 |
| 79 metadata_database()->UnregisterApp(app_id_, callback); | 81 metadata_database()->UnregisterApp(app_id_, callback); |
| 80 } | 82 } |
| 81 | 83 |
| 82 bool UninstallAppTask::IsContextReady() { | 84 bool UninstallAppTask::IsContextReady() { |
| 83 return sync_context_->GetMetadataDatabase() && | 85 return sync_context_->GetMetadataDatabase() && |
| 84 sync_context_->GetDriveService(); | 86 sync_context_->GetDriveService(); |
| 85 } | 87 } |
| 86 | 88 |
| 87 MetadataDatabase* UninstallAppTask::metadata_database() { | 89 MetadataDatabase* UninstallAppTask::metadata_database() { |
| 88 return sync_context_->GetMetadataDatabase(); | 90 return sync_context_->GetMetadataDatabase(); |
| 89 } | 91 } |
| 90 | 92 |
| 91 drive::DriveServiceInterface* UninstallAppTask::drive_service() { | 93 drive::DriveServiceInterface* UninstallAppTask::drive_service() { |
| 92 set_used_network(true); | 94 set_used_network(true); |
| 93 return sync_context_->GetDriveService(); | 95 return sync_context_->GetDriveService(); |
| 94 } | 96 } |
| 95 | 97 |
| 96 } // namespace drive_backend | 98 } // namespace drive_backend |
| 97 } // namespace sync_file_system | 99 } // namespace sync_file_system |
| OLD | NEW |