| 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/copy_operation.h" | 5 #include "chrome/browser/chromeos/drive/file_system/copy_operation.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/task_runner_util.h" | 10 #include "base/task_runner_util.h" |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 remote_dest_path.DirName(), parent_entry); | 227 remote_dest_path.DirName(), parent_entry); |
| 228 if (error != FILE_ERROR_OK) | 228 if (error != FILE_ERROR_OK) |
| 229 return error; | 229 return error; |
| 230 | 230 |
| 231 // The destination's parent must be a directory. | 231 // The destination's parent must be a directory. |
| 232 if (!parent_entry->file_info().is_directory()) | 232 if (!parent_entry->file_info().is_directory()) |
| 233 return FILE_ERROR_NOT_A_DIRECTORY; | 233 return FILE_ERROR_NOT_A_DIRECTORY; |
| 234 | 234 |
| 235 // Try to parse GDoc File and extract the resource id, if necessary. | 235 // Try to parse GDoc File and extract the resource id, if necessary. |
| 236 // Failing isn't problem. It'd be handled as a regular file, then. | 236 // Failing isn't problem. It'd be handled as a regular file, then. |
| 237 if (util::HasGDocFileExtension(local_src_path)) | 237 if (util::HasHostedDocumentExtension(local_src_path)) |
| 238 *gdoc_resource_id = util::ReadResourceIdFromGDocFile(local_src_path); | 238 *gdoc_resource_id = util::ReadResourceIdFromGDocFile(local_src_path); |
| 239 return FILE_ERROR_OK; | 239 return FILE_ERROR_OK; |
| 240 } | 240 } |
| 241 | 241 |
| 242 // Performs local work before server-side work for transferring JSON-represented | 242 // Performs local work before server-side work for transferring JSON-represented |
| 243 // gdoc files. | 243 // gdoc files. |
| 244 FileError LocalWorkForTransferJsonGdocFile( | 244 FileError LocalWorkForTransferJsonGdocFile( |
| 245 internal::ResourceMetadata* metadata, | 245 internal::ResourceMetadata* metadata, |
| 246 CopyOperation::TransferJsonGdocParams* params) { | 246 CopyOperation::TransferJsonGdocParams* params) { |
| 247 std::string local_id; | 247 std::string local_id; |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 FileChange changed_file; | 661 FileChange changed_file; |
| 662 changed_file.Update(remote_dest_path, *entry, FileChange::ADD_OR_UPDATE); | 662 changed_file.Update(remote_dest_path, *entry, FileChange::ADD_OR_UPDATE); |
| 663 delegate_->OnFileChangedByOperation(changed_file); | 663 delegate_->OnFileChangedByOperation(changed_file); |
| 664 delegate_->OnEntryUpdatedByOperation(*local_id); | 664 delegate_->OnEntryUpdatedByOperation(*local_id); |
| 665 } | 665 } |
| 666 callback.Run(error); | 666 callback.Run(error); |
| 667 } | 667 } |
| 668 | 668 |
| 669 } // namespace file_system | 669 } // namespace file_system |
| 670 } // namespace drive | 670 } // namespace drive |
| OLD | NEW |