summaryrefslogtreecommitdiffstats
path: root/chrome/common/resource_dispatcher.cc
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-13 23:14:40 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-13 23:14:40 +0000
commitccef48cca72fbc8905a643759092ee0d913aca9c (patch)
tree041f0aacda14588d719103e13851a6574c89b62c /chrome/common/resource_dispatcher.cc
parent314e9e40626d06dca6c19425b07c881d1d3321a3 (diff)
downloadchromium_src-ccef48cca72fbc8905a643759092ee0d913aca9c.zip
chromium_src-ccef48cca72fbc8905a643759092ee0d913aca9c.tar.gz
chromium_src-ccef48cca72fbc8905a643759092ee0d913aca9c.tar.bz2
Implementation of ResourceDispatcher::OnDownloadProgress
Implemented ResourceDispatcher::OnDownloadProgress to handle ViewMsg_DownloadProgress IPC message, implementation is a clone of ResourceDispatcher::OnUploadProgress because they have identical behavior. Review URL: http://codereview.chromium.org/39104 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11681 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/resource_dispatcher.cc')
-rw-r--r--chrome/common/resource_dispatcher.cc24
1 files changed, 20 insertions, 4 deletions
diff --git a/chrome/common/resource_dispatcher.cc b/chrome/common/resource_dispatcher.cc
index 32f15b1..be45a38 100644
--- a/chrome/common/resource_dispatcher.cc
+++ b/chrome/common/resource_dispatcher.cc
@@ -276,10 +276,26 @@ 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.
+ const IPC::Message& message, int request_id, int64 position, int64 size) {
+ 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(message.routing_id(), request_id));
+ }
}
void ResourceDispatcher::OnUploadProgress(