Index: chrome/browser/ui/browser.cc |
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc |
index 11d6d4e9c3a3421f297a7fdcba42b8c5e8c9d074..1087a1ee89de0ec66ee9c1076758fa37fd96e5b8 100644 |
--- a/chrome/browser/ui/browser.cc |
+++ b/chrome/browser/ui/browser.cc |
@@ -1237,6 +1237,27 @@ void Browser::MaybeUpdateBookmarkBarStateForInstantOverlay( |
} |
} |
+void Browser::ShowDownload(content::DownloadItem* download) { |
+ if (!window()) |
+ return; |
+ |
+ // If the download occurs in a new tab, and it's not a save page |
+ // download (started before initial navigation completed) close it. |
+ WebContents* source = download->GetWebContents(); |
+ if (source && source->GetController().IsInitialNavigation() && |
+ tab_strip_model_->count() > 1 && !download->IsSavePackageDownload()) { |
+ CloseContents(source); |
+ } |
+ |
+ // Some (app downloads) are not supposed to appear on the shelf. |
+ if (!DownloadItemModel(download).ShouldShowInShelf()) |
+ return; |
+ |
+ // GetDownloadShelf creates the download shelf if it was not yet created. |
+ DownloadShelf* shelf = window()->GetDownloadShelf(); |
+ shelf->AddDownload(download); |
+} |
+ |
/////////////////////////////////////////////////////////////////////////////// |
// Browser, content::WebContentsDelegate implementation: |
@@ -1402,32 +1423,6 @@ int Browser::GetExtraRenderViewHeight() const { |
return window_->GetExtraRenderViewHeight(); |
} |
-void Browser::OnStartDownload(WebContents* source, |
- content::DownloadItem* download) { |
- if (!DownloadItemModel(download).ShouldShowInShelf()) |
- return; |
- |
- WebContents* constrained = GetConstrainingWebContents(source); |
- if (constrained != source) { |
- // Download in a constrained popup is shown in the tab that opened it. |
- constrained->GetDelegate()->OnStartDownload(constrained, download); |
- return; |
- } |
- |
- if (!window()) |
- return; |
- |
- // GetDownloadShelf creates the download shelf if it was not yet created. |
- DownloadShelf* shelf = window()->GetDownloadShelf(); |
- shelf->AddDownload(download); |
- |
- // If the download occurs in a new tab, and it's not a save page |
- // download (started before initial navigation completed), close it. |
- if (source->GetController().IsInitialNavigation() && |
- tab_strip_model_->count() > 1 && !download->IsSavePackageDownload()) |
- CloseContents(source); |
-} |
- |
void Browser::ViewSourceForTab(WebContents* source, const GURL& page_url) { |
DCHECK(source); |
chrome::ViewSource(this, source); |