feat: add getUploadProgress API to the net API (#14446)
This commit is contained in:
parent
ce592a5705
commit
89a6f1efbb
6 changed files with 45 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue