Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Unified Diff: google_apis/drive/base_requests.cc

Issue 1130183003: Notify upload progress from batch request to its child requests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: google_apis/drive/base_requests.cc
diff --git a/google_apis/drive/base_requests.cc b/google_apis/drive/base_requests.cc
index 164be2e16a3b3fb7197bed7be2706bbefaf78b2a..9919160eba4fd7d4cc3458d50c602f721cf92e68 100644
--- a/google_apis/drive/base_requests.cc
+++ b/google_apis/drive/base_requests.cc
@@ -128,8 +128,8 @@ bool GetMultipartContent(const std::string& predetermined_boundary,
return false;
google_apis::ContentTypeAndData output;
- GenerateMultipartBody(
- google_apis::MULTIPART_RELATED, predetermined_boundary, parts, &output);
+ GenerateMultipartBody(google_apis::MULTIPART_RELATED, predetermined_boundary,
+ parts, &output, nullptr);
upload_content_type->swap(output.type);
upload_content_data->swap(output.data);
return true;
@@ -166,7 +166,8 @@ scoped_ptr<base::Value> ParseJson(const std::string& json) {
void GenerateMultipartBody(MultipartType multipart_type,
const std::string& predetermined_boundary,
const std::vector<ContentTypeAndData>& parts,
- ContentTypeAndData* output) {
+ ContentTypeAndData* output,
+ std::vector<uint64>* data_positions) {
std::string boundary;
// Generate random boundary.
if (predetermined_boundary.empty()) {
@@ -202,9 +203,13 @@ void GenerateMultipartBody(MultipartType multipart_type,
}
output->data.clear();
+ if (data_positions)
+ data_positions->clear();
for (auto& part : parts) {
output->data.append(base::StringPrintf(
kMultipartItemHeaderFormat, boundary.c_str(), part.type.c_str()));
+ if (data_positions)
+ data_positions->push_back(output->data.size());
output->data.append(part.data);
output->data.append("\n");
}

Powered by Google App Engine
This is Rietveld 408576698