summaryrefslogtreecommitdiffstats
path: root/chrome/browser/external_tab_container_win.cc
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-18 14:40:27 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-18 14:40:27 +0000
commitddb8505095f8aa6a76a938c5c0019b0c537b8e94 (patch)
tree6e241cf6be6b7c5aa0f132b3bb249392f61d73f0 /chrome/browser/external_tab_container_win.cc
parent8d3a1274d60801b4bc11e49c0ab9c54141ed1d25 (diff)
downloadchromium_src-ddb8505095f8aa6a76a938c5c0019b0c537b8e94.zip
chromium_src-ddb8505095f8aa6a76a938c5c0019b0c537b8e94.tar.gz
chromium_src-ddb8505095f8aa6a76a938c5c0019b0c537b8e94.tar.bz2
Move download stuff to download tab helper.
BUG=71097 TEST=zero visible change in how the download system works Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=85486 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=85504 Review URL: http://codereview.chromium.org/6973035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85762 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/external_tab_container_win.cc')
-rw-r--r--chrome/browser/external_tab_container_win.cc51
1 files changed, 31 insertions, 20 deletions
diff --git a/chrome/browser/external_tab_container_win.cc b/chrome/browser/external_tab_container_win.cc
index 86e227d..68c0469 100644
--- a/chrome/browser/external_tab_container_win.cc
+++ b/chrome/browser/external_tab_container_win.cc
@@ -23,6 +23,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window.h"
+#include "chrome/browser/ui/download/download_tab_helper.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/browser/ui/views/browser_dialogs.h"
#include "chrome/browser/ui/views/infobars/infobar_container_view.h"
@@ -162,6 +163,7 @@ bool ExternalTabContainer::Init(Profile* profile,
tab_contents_->set_infobars_enabled(false);
tab_contents_->tab_contents()->set_delegate(this);
+ tab_contents_->download_tab_helper()->set_delegate(this);
tab_contents_->tab_contents()->
GetMutableRendererPrefs()->browser_handles_top_level_requests =
@@ -531,26 +533,6 @@ bool ExternalTabContainer::TakeFocus(bool reverse) {
return true;
}
-bool ExternalTabContainer::CanDownload(int request_id) {
- if (load_requests_via_automation_) {
- if (automation_) {
- // In case the host needs to show UI that needs to take the focus.
- ::AllowSetForegroundWindow(ASFW_ANY);
-
- BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
- NewRunnableMethod(automation_resource_message_filter_.get(),
- &AutomationResourceMessageFilter::SendDownloadRequestToHost,
- 0, tab_handle_, request_id));
- }
- } else {
- DLOG(WARNING) << "Downloads are only supported with host browser network "
- "stack enabled.";
- }
-
- // Never allow downloads.
- return false;
-}
-
void ExternalTabContainer::ShowPageInfo(Profile* profile,
const GURL& url,
const NavigationEntry::SSLStatus& ssl,
@@ -796,6 +778,35 @@ void ExternalTabContainer::Observe(NotificationType type,
}
////////////////////////////////////////////////////////////////////////////////
+// ExternalTabContainer, DownloadTabHelperDelegate overrides:
+
+bool ExternalTabContainer::CanDownload(int request_id) {
+ if (load_requests_via_automation_) {
+ if (automation_) {
+ // In case the host needs to show UI that needs to take the focus.
+ ::AllowSetForegroundWindow(ASFW_ANY);
+
+ BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
+ NewRunnableMethod(automation_resource_message_filter_.get(),
+ &AutomationResourceMessageFilter::SendDownloadRequestToHost,
+ 0, tab_handle_, request_id));
+ }
+ } else {
+ DLOG(WARNING) << "Downloads are only supported with host browser network "
+ "stack enabled.";
+ }
+
+ // Never allow downloads.
+ return false;
+}
+
+void ExternalTabContainer::OnStartDownload(DownloadItem* download,
+ TabContentsWrapper* tab) {
+ // Downloads are handled by Automation.
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
// ExternalTabContainer, views::WidgetWin overrides:
LRESULT ExternalTabContainer::OnCreate(LPCREATESTRUCT create_struct) {