feat: add getUploadProgress API to the net API (#13783)

This commit is contained in:
Samuel Attard 2018-07-28 00:15:48 +10:00 committed by Charles Kerr
parent c8dc2d3730
commit 4b3011f3e8
6 changed files with 45 additions and 0 deletions

View file

@ -504,4 +504,16 @@ void AtomURLRequest::InformDelegateErrorOccured(const std::string& error,
delegate_->OnError(error, isRequestError);
}
void AtomURLRequest::GetUploadProgress(mate::Dictionary* progress) const {
net::UploadProgress upload_progress;
if (request_) {
progress->Set("started", true);
upload_progress = request_->GetUploadProgress();
} else {
progress->Set("started", false);
}
progress->Set("current", upload_progress.position());
progress->Set("total", upload_progress.size());
}
} // namespace atom