| 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 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 902 } | 902 } |
| 903 | 903 |
| 904 std::string mime_type = GetMimeTypeFromTitle(entry->title()); | 904 std::string mime_type = GetMimeTypeFromTitle(entry->title()); |
| 905 UploadKey upload_key = RegisterUploadCallback(callback); | 905 UploadKey upload_key = RegisterUploadCallback(callback); |
| 906 ResourceEntryCallback did_upload_callback = | 906 ResourceEntryCallback did_upload_callback = |
| 907 base::Bind(&APIUtil::DidUploadExistingFile, AsWeakPtr(), upload_key); | 907 base::Bind(&APIUtil::DidUploadExistingFile, AsWeakPtr(), upload_key); |
| 908 drive_uploader_->UploadExistingFile( | 908 drive_uploader_->UploadExistingFile( |
| 909 entry->resource_id(), | 909 entry->resource_id(), |
| 910 local_file_path, | 910 local_file_path, |
| 911 mime_type, | 911 mime_type, |
| 912 // Don't use etag for uploading for now. http://crbug.com/278201 | 912 entry->etag(), |
| 913 std::string(), // entry->etag(), | |
| 914 base::Bind(&UploadResultAdapter, did_upload_callback), | 913 base::Bind(&UploadResultAdapter, did_upload_callback), |
| 915 google_apis::ProgressCallback()); | 914 google_apis::ProgressCallback()); |
| 916 } | 915 } |
| 917 | 916 |
| 918 bool APIUtil::IsAuthenticated() const { | 917 bool APIUtil::IsAuthenticated() const { |
| 919 return drive_service_->HasRefreshToken(); | 918 return drive_service_->HasRefreshToken(); |
| 920 } | 919 } |
| 921 | 920 |
| 922 void APIUtil::DidUploadExistingFile( | 921 void APIUtil::DidUploadExistingFile( |
| 923 UploadKey upload_key, | 922 UploadKey upload_key, |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1139 } | 1138 } |
| 1140 | 1139 |
| 1141 std::string APIUtil::GetRootResourceId() const { | 1140 std::string APIUtil::GetRootResourceId() const { |
| 1142 if (IsDriveAPIDisabled()) | 1141 if (IsDriveAPIDisabled()) |
| 1143 return drive_service_->GetRootResourceId(); | 1142 return drive_service_->GetRootResourceId(); |
| 1144 return root_resource_id_; | 1143 return root_resource_id_; |
| 1145 } | 1144 } |
| 1146 | 1145 |
| 1147 } // namespace drive_backend | 1146 } // namespace drive_backend |
| 1148 } // namespace sync_file_system | 1147 } // namespace sync_file_system |
| OLD | NEW |