| 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/gdata/gdata_download_observer.h" | 5 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 DCHECK(upload_data); | 536 DCHECK(upload_data); |
| 537 | 537 |
| 538 upload_data->set_resource_id(entry_proto->resource_id()); | 538 upload_data->set_resource_id(entry_proto->resource_id()); |
| 539 upload_data->set_md5(entry_proto->file_specific_info().file_md5()); | 539 upload_data->set_md5(entry_proto->file_specific_info().file_md5()); |
| 540 upload_data->set_overwrite(true); | 540 upload_data->set_overwrite(true); |
| 541 | 541 |
| 542 StartUpload(download_id, upload_file_info.Pass()); | 542 StartUpload(download_id, upload_file_info.Pass()); |
| 543 } else { | 543 } else { |
| 544 // No file exists at the target path, so upload as a new file. | 544 // No file exists at the target path, so upload as a new file. |
| 545 | 545 |
| 546 // Get the GDataDirectory proto for the upload directory, then extract the | 546 // Get the DriveDirectory proto for the upload directory, then extract the |
| 547 // initial upload URL in OnReadDirectoryByPath(). | 547 // initial upload URL in OnReadDirectoryByPath(). |
| 548 const FilePath upload_dir = upload_file_info->gdata_path.DirName(); | 548 const FilePath upload_dir = upload_file_info->gdata_path.DirName(); |
| 549 file_system_->GetEntryInfoByPath( | 549 file_system_->GetEntryInfoByPath( |
| 550 upload_dir, | 550 upload_dir, |
| 551 base::Bind( | 551 base::Bind( |
| 552 &GDataDownloadObserver::CreateUploadFileInfoAfterCheckTargetDir, | 552 &GDataDownloadObserver::CreateUploadFileInfoAfterCheckTargetDir, |
| 553 weak_ptr_factory_.GetWeakPtr(), | 553 weak_ptr_factory_.GetWeakPtr(), |
| 554 download_id, | 554 download_id, |
| 555 base::Passed(&upload_file_info))); | 555 base::Passed(&upload_file_info))); |
| 556 } | 556 } |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 file_system_->AddUploadedFile(UPLOAD_NEW_FILE, | 665 file_system_->AddUploadedFile(UPLOAD_NEW_FILE, |
| 666 upload_data->virtual_dir_path(), | 666 upload_data->virtual_dir_path(), |
| 667 entry.Pass(), | 667 entry.Pass(), |
| 668 download->GetTargetFilePath(), | 668 download->GetTargetFilePath(), |
| 669 GDataCache::FILE_OPERATION_MOVE, | 669 GDataCache::FILE_OPERATION_MOVE, |
| 670 base::Bind(&base::DoNothing)); | 670 base::Bind(&base::DoNothing)); |
| 671 } | 671 } |
| 672 } | 672 } |
| 673 | 673 |
| 674 } // namespace gdata | 674 } // namespace gdata |
| OLD | NEW |