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

This commit is contained in:
trop[bot] 2018-09-04 12:26:50 -05:00 committed by Charles Kerr
parent ce592a5705
commit 89a6f1efbb
6 changed files with 45 additions and 0 deletions

View file

@ -501,4 +501,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