| 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/sync_file_system/drive_backend/api_util.h" | 5 #include "chrome/browser/sync_file_system/drive_backend/api_util.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <sstream> | 9 #include <sstream> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 // If local file and remote file are same, cancel the download. | 718 // If local file and remote file are same, cancel the download. |
| 719 if (local_file_md5 == entry->file_md5()) { | 719 if (local_file_md5 == entry->file_md5()) { |
| 720 callback.Run(google_apis::HTTP_NOT_MODIFIED, | 720 callback.Run(google_apis::HTTP_NOT_MODIFIED, |
| 721 local_file_md5, | 721 local_file_md5, |
| 722 entry->file_size(), | 722 entry->file_size(), |
| 723 entry->updated_time()); | 723 entry->updated_time()); |
| 724 return; | 724 return; |
| 725 } | 725 } |
| 726 | 726 |
| 727 DVLOG(2) << "Downloading file: " << entry->resource_id(); | 727 DVLOG(2) << "Downloading file: " << entry->resource_id(); |
| 728 const GURL& download_url = entry->download_url(); | 728 const std::string& resource_id = entry->resource_id(); |
| 729 drive_service_->DownloadFile(local_file_path, | 729 drive_service_->DownloadFile(local_file_path, |
| 730 download_url, | 730 resource_id, |
| 731 base::Bind(&APIUtil::DidDownloadFile, | 731 base::Bind(&APIUtil::DidDownloadFile, |
| 732 AsWeakPtr(), | 732 AsWeakPtr(), |
| 733 base::Passed(&entry), | 733 base::Passed(&entry), |
| 734 callback), | 734 callback), |
| 735 google_apis::GetContentCallback(), | 735 google_apis::GetContentCallback(), |
| 736 google_apis::ProgressCallback()); | 736 google_apis::ProgressCallback()); |
| 737 } | 737 } |
| 738 | 738 |
| 739 void APIUtil::DidDownloadFile(scoped_ptr<google_apis::ResourceEntry> entry, | 739 void APIUtil::DidDownloadFile(scoped_ptr<google_apis::ResourceEntry> entry, |
| 740 const DownloadFileCallback& callback, | 740 const DownloadFileCallback& callback, |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1078 } | 1078 } |
| 1079 | 1079 |
| 1080 std::string APIUtil::GetRootResourceId() const { | 1080 std::string APIUtil::GetRootResourceId() const { |
| 1081 if (IsDriveAPIDisabled()) | 1081 if (IsDriveAPIDisabled()) |
| 1082 return drive_service_->GetRootResourceId(); | 1082 return drive_service_->GetRootResourceId(); |
| 1083 return root_resource_id_; | 1083 return root_resource_id_; |
| 1084 } | 1084 } |
| 1085 | 1085 |
| 1086 } // namespace drive_backend | 1086 } // namespace drive_backend |
| 1087 } // namespace sync_file_system | 1087 } // namespace sync_file_system |
| OLD | NEW |