Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(585)

Unified Diff: content/browser/download/download_manager_impl.cc

Issue 10735089: DownloadManager::Observer::OnDownloadCreated (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/download/download_manager_impl.cc
diff --git a/content/browser/download/download_manager_impl.cc b/content/browser/download/download_manager_impl.cc
index 7570379eae814d624bfda65aab7759e8e965baef..7a15cc2ee8d83b02996c3c3fbfeff7a6cc90f178 100644
--- a/content/browser/download/download_manager_impl.cc
+++ b/content/browser/download/download_manager_impl.cc
@@ -108,6 +108,7 @@ void BeginDownload(content::DownloadUrlParameters* params) {
request->SetExtraRequestHeaderByName(
iter->first, iter->second, false/*overwrite*/);
}
+ LOG(INFO) << "occam " << __FUNCTION__;
params->resource_dispatcher_host()->BeginDownload(
request.Pass(),
params->content_initiated(),
@@ -400,6 +401,7 @@ content::DownloadId DownloadManagerImpl::StartDownload(
scoped_ptr<DownloadCreateInfo> info,
scoped_ptr<content::ByteStreamReader> stream) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ LOG(INFO) << "occam " << __FUNCTION__;
// |bound_net_log| will be used for logging both the download item's and
// the download file's events.
@@ -524,6 +526,7 @@ net::BoundNetLog DownloadManagerImpl::CreateDownloadItem(
net::BoundNetLog::Make(net_log_, net::NetLog::SOURCE_DOWNLOAD);
if (!info->download_id.IsValid())
info->download_id = GetNextId();
+ LOG(INFO) << "occam " << __FUNCTION__ << " " << info->download_id;
DownloadItemImpl* download = factory_->CreateActiveItem(
this, *info,
scoped_ptr<DownloadRequestHandleInterface>(
@@ -534,6 +537,7 @@ net::BoundNetLog DownloadManagerImpl::CreateDownloadItem(
downloads_[download->GetId()] = download;
DCHECK(!ContainsKey(active_downloads_, download->GetId()));
active_downloads_[download->GetId()] = download;
+ FOR_EACH_OBSERVER(Observer, observers_, OnDownloadCreated(this, download));
return bound_net_log;
}
@@ -563,6 +567,10 @@ DownloadItemImpl* DownloadManagerImpl::CreateSavePackageDownloadItem(
new SavePageExternalData(download);
DCHECK(SavePageExternalData::Get(download));
+ // TODO(benjhayden): Fire OnDownloadCreated for SavePackage downloads when
+ // we're comfortable with the user interacting with them.
+ // FOR_EACH_OBSERVER(Observer, observers_, OnDownloadCreated(this, download));
+
// Will notify the observer in the callback.
if (delegate_)
delegate_->AddItemToPersistentStore(download);
@@ -947,6 +955,7 @@ void DownloadManagerImpl::OnPersistentStoreQueryComplete(
this, GetNextId(), entries->at(i), bound_net_log);
DCHECK(!ContainsKey(downloads_, download->GetId()));
downloads_[download->GetId()] = download;
+ FOR_EACH_OBSERVER(Observer, observers_, OnDownloadCreated(this, download));
VLOG(20) << __FUNCTION__ << "()" << i << ">"
<< " download = " << download->DebugString(true);
}

Powered by Google App Engine
This is Rietveld 408576698