| 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/move_operation.h" | 5 #include "chrome/browser/chromeos/drive/file_system/move_operation.h" |
| 6 | 6 |
| 7 #include "base/sequenced_task_runner.h" | 7 #include "base/sequenced_task_runner.h" |
| 8 #include "chrome/browser/chromeos/drive/drive.pb.h" | 8 #include "chrome/browser/chromeos/drive/drive.pb.h" |
| 9 #include "chrome/browser/chromeos/drive/file_change.h" | 9 #include "chrome/browser/chromeos/drive/file_change.h" |
| 10 #include "chrome/browser/chromeos/drive/file_system/operation_observer.h" | 10 #include "chrome/browser/chromeos/drive/file_system/operation_delegate.h" |
| 11 #include "chrome/browser/chromeos/drive/resource_metadata.h" | 11 #include "chrome/browser/chromeos/drive/resource_metadata.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 drive { | 16 namespace drive { |
| 17 namespace file_system { | 17 namespace file_system { |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 // Looks up ResourceEntry for source entry and the destination directory. | 20 // Looks up ResourceEntry for source entry and the destination directory. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 if (error != FILE_ERROR_OK) | 60 if (error != FILE_ERROR_OK) |
| 61 return error; | 61 return error; |
| 62 | 62 |
| 63 changed_files->Update(dest_path, entry, FileChange::ADD_OR_UPDATE); | 63 changed_files->Update(dest_path, entry, FileChange::ADD_OR_UPDATE); |
| 64 return FILE_ERROR_OK; | 64 return FILE_ERROR_OK; |
| 65 } | 65 } |
| 66 | 66 |
| 67 } // namespace | 67 } // namespace |
| 68 | 68 |
| 69 MoveOperation::MoveOperation(base::SequencedTaskRunner* blocking_task_runner, | 69 MoveOperation::MoveOperation(base::SequencedTaskRunner* blocking_task_runner, |
| 70 OperationObserver* observer, | 70 OperationDelegate* delegate, |
| 71 internal::ResourceMetadata* metadata) | 71 internal::ResourceMetadata* metadata) |
| 72 : blocking_task_runner_(blocking_task_runner), | 72 : blocking_task_runner_(blocking_task_runner), |
| 73 observer_(observer), | 73 delegate_(delegate), |
| 74 metadata_(metadata), | 74 metadata_(metadata), |
| 75 weak_ptr_factory_(this) { | 75 weak_ptr_factory_(this) { |
| 76 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 76 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 77 } | 77 } |
| 78 | 78 |
| 79 MoveOperation::~MoveOperation() { | 79 MoveOperation::~MoveOperation() { |
| 80 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 80 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void MoveOperation::Move(const base::FilePath& src_file_path, | 83 void MoveOperation::Move(const base::FilePath& src_file_path, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 105 } | 105 } |
| 106 | 106 |
| 107 void MoveOperation::MoveAfterUpdateLocalState( | 107 void MoveOperation::MoveAfterUpdateLocalState( |
| 108 const FileOperationCallback& callback, | 108 const FileOperationCallback& callback, |
| 109 const FileChange* changed_files, | 109 const FileChange* changed_files, |
| 110 const std::string* local_id, | 110 const std::string* local_id, |
| 111 FileError error) { | 111 FileError error) { |
| 112 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 112 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 113 if (error == FILE_ERROR_OK) { | 113 if (error == FILE_ERROR_OK) { |
| 114 // Notify the change of directory. | 114 // Notify the change of directory. |
| 115 observer_->OnFileChangedByOperation(*changed_files); | 115 delegate_->OnFileChangedByOperation(*changed_files); |
| 116 observer_->OnEntryUpdatedByOperation(*local_id); | 116 delegate_->OnEntryUpdatedByOperation(*local_id); |
| 117 } | 117 } |
| 118 callback.Run(error); | 118 callback.Run(error); |
| 119 } | 119 } |
| 120 | 120 |
| 121 } // namespace file_system | 121 } // namespace file_system |
| 122 } // namespace drive | 122 } // namespace drive |
| OLD | NEW |