| 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 "google_apis/drive/drive_api_requests.h" | 5 #include "google_apis/drive/drive_api_requests.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1304 method = "POST"; | 1304 method = "POST"; |
| 1305 break; | 1305 break; |
| 1306 case net::URLFetcher::PUT: | 1306 case net::URLFetcher::PUT: |
| 1307 method = "PUT"; | 1307 method = "PUT"; |
| 1308 break; | 1308 break; |
| 1309 default: | 1309 default: |
| 1310 NOTREACHED(); | 1310 NOTREACHED(); |
| 1311 break; | 1311 break; |
| 1312 } | 1312 } |
| 1313 const std::string header = base::StringPrintf( | 1313 const std::string header = base::StringPrintf( |
| 1314 kBatchUploadRequestFormat, method.c_str(), url.path().c_str(), | 1314 kBatchUploadRequestFormat, method.c_str(), |
| 1315 url.path().as_string().c_str(), |
| 1315 url_generator_.GetBatchUploadUrl().host().c_str(), type.c_str()); | 1316 url_generator_.GetBatchUploadUrl().host().c_str(), type.c_str()); |
| 1316 | 1317 |
| 1317 child->data_offset = header.size(); | 1318 child->data_offset = header.size(); |
| 1318 child->data_size = data.size(); | 1319 child->data_size = data.size(); |
| 1319 total_size += data.size(); | 1320 total_size += data.size(); |
| 1320 | 1321 |
| 1321 parts.push_back(ContentTypeAndData({kHttpContentType, header + data})); | 1322 parts.push_back(ContentTypeAndData({kHttpContentType, header + data})); |
| 1322 } | 1323 } |
| 1323 | 1324 |
| 1324 UMA_HISTOGRAM_COUNTS_100(kUMADriveTotalFileCountInBatchUpload, parts.size()); | 1325 UMA_HISTOGRAM_COUNTS_100(kUMADriveTotalFileCountInBatchUpload, parts.size()); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1425 } else if (last_progress_value_ < child->data_offset + child->data_size && | 1426 } else if (last_progress_value_ < child->data_offset + child->data_size && |
| 1426 child->data_offset + child->data_size < current) { | 1427 child->data_offset + child->data_size < current) { |
| 1427 child->request->NotifyUploadProgress(source, child->data_size, | 1428 child->request->NotifyUploadProgress(source, child->data_size, |
| 1428 child->data_size); | 1429 child->data_size); |
| 1429 } | 1430 } |
| 1430 } | 1431 } |
| 1431 last_progress_value_ = current; | 1432 last_progress_value_ = current; |
| 1432 } | 1433 } |
| 1433 } // namespace drive | 1434 } // namespace drive |
| 1434 } // namespace google_apis | 1435 } // namespace google_apis |
| OLD | NEW |