summaryrefslogtreecommitdiffstats
path: root/chrome/browser/tab_contents
diff options
context:
space:
mode:
authorbauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-03 11:46:51 +0000
committerbauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-03 11:46:51 +0000
commit5b928b61b71e42778c5dc5d62a913e6784f4df99 (patch)
treed71856ed72f8205e8c2b85c584dc9952630b8d44 /chrome/browser/tab_contents
parent450429a92e89e71de860f2158efd626795c9b830 (diff)
downloadchromium_src-5b928b61b71e42778c5dc5d62a913e6784f4df99.zip
chromium_src-5b928b61b71e42778c5dc5d62a913e6784f4df99.tar.gz
chromium_src-5b928b61b71e42778c5dc5d62a913e6784f4df99.tar.bz2
Only close a newly opened download tab if there's more than one tab.
BUG=45464,10764 TEST=See first bug for manual test. Review URL: http://codereview.chromium.org/3029040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54737 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tab_contents')
-rw-r--r--chrome/browser/tab_contents/tab_contents.cc8
-rw-r--r--chrome/browser/tab_contents/tab_contents_delegate.cc3
-rw-r--r--chrome/browser/tab_contents/tab_contents_delegate.h2
3 files changed, 5 insertions, 8 deletions
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index 18050bf..0111447 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -1144,12 +1144,8 @@ 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()) {
- tab_contents->delegate()->OnStartDownload(download);
- // If the download occurs in a new tab, close it
- if (controller_.IsInitialNavigation() && (tab_contents == this))
- delegate()->CloseContents(this);
- }
+ if (tab_contents && tab_contents->delegate())
+ tab_contents->delegate()->OnStartDownload(download, this);
}
void TabContents::WillClose(ConstrainedWindow* window) {
diff --git a/chrome/browser/tab_contents/tab_contents_delegate.cc b/chrome/browser/tab_contents/tab_contents_delegate.cc
index 9cf9f88..eb3a81f 100644
--- a/chrome/browser/tab_contents/tab_contents_delegate.cc
+++ b/chrome/browser/tab_contents/tab_contents_delegate.cc
@@ -83,7 +83,8 @@ bool TabContentsDelegate::CanDownload(int request_id) {
return true;
}
-void TabContentsDelegate::OnStartDownload(DownloadItem* download) {
+void TabContentsDelegate::OnStartDownload(DownloadItem* download,
+ TabContents* tab) {
}
bool TabContentsDelegate::HandleContextMenu(const ContextMenuParams& params) {
diff --git a/chrome/browser/tab_contents/tab_contents_delegate.h b/chrome/browser/tab_contents/tab_contents_delegate.h
index ff1f49b..f3805a4 100644
--- a/chrome/browser/tab_contents/tab_contents_delegate.h
+++ b/chrome/browser/tab_contents/tab_contents_delegate.h
@@ -195,7 +195,7 @@ class TabContentsDelegate : public AutomationResourceRoutingDelegate {
virtual bool CanDownload(int request_id);
- virtual void OnStartDownload(DownloadItem* download);
+ virtual void OnStartDownload(DownloadItem* download, TabContents* tab);
// Returns true if the context menu operation was handled by the delegate.
virtual bool HandleContextMenu(const ContextMenuParams& params);