| 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/chromeos/drive/file_system/remove_operation.h" | 5 #include "chrome/browser/chromeos/drive/file_system/remove_operation.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chromeos/drive/drive.pb.h" | 7 #include "chrome/browser/chromeos/drive/drive.pb.h" |
| 8 #include "chrome/browser/chromeos/drive/drive_cache.h" | 8 #include "chrome/browser/chromeos/drive/drive_cache.h" |
| 9 #include "chrome/browser/chromeos/drive/drive_file_system.h" | 9 #include "chrome/browser/chromeos/drive/drive_file_system.h" |
| 10 #include "chrome/browser/chromeos/drive/drive_file_system_util.h" | 10 #include "chrome/browser/chromeos/drive/drive_file_system_util.h" |
| 11 #include "chrome/browser/chromeos/drive/drive_service_interface.h" | 11 #include "chrome/browser/chromeos/drive/drive_service_interface.h" |
| 12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
| 13 | 13 |
| 14 using content::BrowserThread; | 14 using content::BrowserThread; |
| 15 | 15 |
| 16 namespace gdata { | 16 namespace drive { |
| 17 namespace file_system { | 17 namespace file_system { |
| 18 | 18 |
| 19 RemoveOperation::RemoveOperation(DriveServiceInterface* drive_service, | 19 RemoveOperation::RemoveOperation(DriveServiceInterface* drive_service, |
| 20 DriveFileSystem* file_system, | 20 DriveFileSystem* file_system, |
| 21 DriveCache* cache) | 21 DriveCache* cache) |
| 22 : drive_service_(drive_service), | 22 : drive_service_(drive_service), |
| 23 file_system_(file_system), | 23 file_system_(file_system), |
| 24 cache_(cache), | 24 cache_(cache), |
| 25 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { | 25 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
| 26 } | 26 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 GURL(entry_proto->edit_url()), | 67 GURL(entry_proto->edit_url()), |
| 68 base::Bind(&RemoveOperation::RemoveResourceLocally, | 68 base::Bind(&RemoveOperation::RemoveResourceLocally, |
| 69 weak_ptr_factory_.GetWeakPtr(), | 69 weak_ptr_factory_.GetWeakPtr(), |
| 70 callback, | 70 callback, |
| 71 entry_proto->resource_id())); | 71 entry_proto->resource_id())); |
| 72 } | 72 } |
| 73 | 73 |
| 74 void RemoveOperation::RemoveResourceLocally( | 74 void RemoveOperation::RemoveResourceLocally( |
| 75 const FileOperationCallback& callback, | 75 const FileOperationCallback& callback, |
| 76 const std::string& resource_id, | 76 const std::string& resource_id, |
| 77 GDataErrorCode status, | 77 gdata::GDataErrorCode status, |
| 78 const GURL& /* document_url */) { | 78 const GURL& /* document_url */) { |
| 79 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 79 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 80 DCHECK(!callback.is_null()); | 80 DCHECK(!callback.is_null()); |
| 81 | 81 |
| 82 DriveFileError error = util::GDataToDriveFileError(status); | 82 DriveFileError error = util::GDataToDriveFileError(status); |
| 83 if (error != DRIVE_FILE_OK) { | 83 if (error != DRIVE_FILE_OK) { |
| 84 callback.Run(error); | 84 callback.Run(error); |
| 85 return; | 85 return; |
| 86 } | 86 } |
| 87 | 87 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 99 DriveFileError error, | 99 DriveFileError error, |
| 100 const FilePath& directory_path) { | 100 const FilePath& directory_path) { |
| 101 if (error == DRIVE_FILE_OK) | 101 if (error == DRIVE_FILE_OK) |
| 102 file_system_->OnDirectoryChanged(directory_path); | 102 file_system_->OnDirectoryChanged(directory_path); |
| 103 | 103 |
| 104 if (!callback.is_null()) | 104 if (!callback.is_null()) |
| 105 callback.Run(error); | 105 callback.Run(error); |
| 106 } | 106 } |
| 107 | 107 |
| 108 } // namespace file_system | 108 } // namespace file_system |
| 109 } // namespace gdata | 109 } // namespace drive |
| OLD | NEW |