summaryrefslogtreecommitdiffstats
path: root/chrome/browser/tab_contents/tab_contents.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/tab_contents/tab_contents.cc')
-rw-r--r--chrome/browser/tab_contents/tab_contents.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index e2744e1..42b8a64 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -1113,8 +1113,12 @@ void TabContents::OnStartDownload(DownloadItem* download) {
// Download in a constrained popup is shown in the tab that opened it.
TabContents* tab_contents = delegate()->GetConstrainingContents(this);
- if (tab_contents && tab_contents->delegate())
+ if (tab_contents && tab_contents->delegate()) {
tab_contents->delegate()->OnStartDownload(download);
+ // If the download occurs in a new tab, close it
+ if (controller_.IsInitialNavigation() && (tab_contents == this))
+ delegate()->CloseContents(this);
+ }
}
void TabContents::WillClose(ConstrainedWindow* window) {