| 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/chromeos/extensions/file_manager/private_api_file_syste
m.h" | 5 #include "chrome/browser/chromeos/extensions/file_manager/private_api_file_syste
m.h" |
| 6 | 6 |
| 7 #include <sys/statvfs.h> | 7 #include <sys/statvfs.h> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 storage::FileSystemOperationRunner::OperationID StartCopyOnIOThread( | 177 storage::FileSystemOperationRunner::OperationID StartCopyOnIOThread( |
| 178 void* profile_id, | 178 void* profile_id, |
| 179 scoped_refptr<storage::FileSystemContext> file_system_context, | 179 scoped_refptr<storage::FileSystemContext> file_system_context, |
| 180 const FileSystemURL& source_url, | 180 const FileSystemURL& source_url, |
| 181 const FileSystemURL& destination_url) { | 181 const FileSystemURL& destination_url) { |
| 182 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 182 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 183 | 183 |
| 184 // Note: |operation_id| is owned by the callback for | 184 // Note: |operation_id| is owned by the callback for |
| 185 // FileSystemOperationRunner::Copy(). It is always called in the next message | 185 // FileSystemOperationRunner::Copy(). It is always called in the next message |
| 186 // loop or later, so at least during this invocation it should alive. | 186 // loop or later, so at least during this invocation it should alive. |
| 187 // |
| 188 // TODO(yawano): change ERROR_BEHAVIOR_TERMINATE to ERROR_BEHAVIOR_CONTINUE |
| 189 // after error messages of individual operations become appear in |
| 190 // the Files.app UI. |
| 187 storage::FileSystemOperationRunner::OperationID* operation_id = | 191 storage::FileSystemOperationRunner::OperationID* operation_id = |
| 188 new storage::FileSystemOperationRunner::OperationID; | 192 new storage::FileSystemOperationRunner::OperationID; |
| 189 *operation_id = file_system_context->operation_runner()->Copy( | 193 *operation_id = file_system_context->operation_runner()->Copy( |
| 190 source_url, | 194 source_url, destination_url, |
| 191 destination_url, | |
| 192 storage::FileSystemOperation::OPTION_PRESERVE_LAST_MODIFIED, | 195 storage::FileSystemOperation::OPTION_PRESERVE_LAST_MODIFIED, |
| 196 storage::FileSystemOperation::ERROR_BEHAVIOR_TERMINATE, |
| 193 base::Bind(&OnCopyProgress, profile_id, base::Unretained(operation_id)), | 197 base::Bind(&OnCopyProgress, profile_id, base::Unretained(operation_id)), |
| 194 base::Bind(&OnCopyCompleted, | 198 base::Bind(&OnCopyCompleted, profile_id, base::Owned(operation_id), |
| 195 profile_id, | 199 source_url, destination_url)); |
| 196 base::Owned(operation_id), | |
| 197 source_url, | |
| 198 destination_url)); | |
| 199 return *operation_id; | 200 return *operation_id; |
| 200 } | 201 } |
| 201 | 202 |
| 202 void OnCopyCancelled(base::File::Error error) { | 203 void OnCopyCancelled(base::File::Error error) { |
| 203 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 204 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 204 | 205 |
| 205 // We just ignore the status if the copy is actually cancelled or not, | 206 // We just ignore the status if the copy is actually cancelled or not, |
| 206 // because failing cancellation means the operation is not running now. | 207 // because failing cancellation means the operation is not running now. |
| 207 DLOG_IF(WARNING, error != base::File::FILE_OK) | 208 DLOG_IF(WARNING, error != base::File::FILE_OK) |
| 208 << "Failed to cancel copy: " << error; | 209 << "Failed to cancel copy: " << error; |
| (...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 936 return RespondLater(); | 937 return RespondLater(); |
| 937 } | 938 } |
| 938 | 939 |
| 939 void FileManagerPrivateSetEntryTagFunction::OnSetEntryPropertyCompleted( | 940 void FileManagerPrivateSetEntryTagFunction::OnSetEntryPropertyCompleted( |
| 940 drive::FileError result) { | 941 drive::FileError result) { |
| 941 Respond(result == drive::FILE_ERROR_OK ? NoArguments() | 942 Respond(result == drive::FILE_ERROR_OK ? NoArguments() |
| 942 : Error("Failed to set a tag.")); | 943 : Error("Failed to set a tag.")); |
| 943 } | 944 } |
| 944 | 945 |
| 945 } // namespace extensions | 946 } // namespace extensions |
| OLD | NEW |