summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/common/resource_dispatcher.cc22
1 files changed, 19 insertions, 3 deletions
diff --git a/chrome/common/resource_dispatcher.cc b/chrome/common/resource_dispatcher.cc
index 709efed..cd78b0e 100644
--- a/chrome/common/resource_dispatcher.cc
+++ b/chrome/common/resource_dispatcher.cc
@@ -280,9 +280,25 @@ bool ResourceDispatcher::OnMessageReceived(const IPC::Message& message) {
void ResourceDispatcher::OnDownloadProgress(
int request_id, int64 position, int64 size) {
- // TODO(hclam): delegate this message to
- // ResourceLoaderBridge::Peer::OnDownloadProgress and send an ACK message
- // back to ResourceDispatcherHost.
+ PendingRequestList::iterator it = pending_requests_.find(request_id);
+ if (it == pending_requests_.end()) {
+ DLOG(WARNING) << "Got download progress for a nonexistant or "
+ " finished requests";
+ return;
+ }
+
+ PendingRequestInfo& request_info = it->second;
+
+ RESOURCE_LOG("Dispatching download progress for " <<
+ request_info.peer->GetURLForDebugging());
+ request_info.peer->OnDownloadProgress(position, size);
+
+ // Send the ACK message back.
+ IPC::Message::Sender* sender = message_sender();
+ if (sender) {
+ sender->Send(
+ new ViewHostMsg_DownloadProgress_ACK(MSG_ROUTING_NONE, request_id));
+ }
}
void ResourceDispatcher::OnUploadProgress(