| Index: chrome/browser/ui/browser.cc
|
| ===================================================================
|
| --- chrome/browser/ui/browser.cc (revision 85514)
|
| +++ chrome/browser/ui/browser.cc (working copy)
|
| @@ -3299,6 +3299,51 @@
|
| return window_->GetExtraRenderViewHeight();
|
| }
|
|
|
| +void Browser::OnStartDownload(DownloadItem* download, TabContents* tab) {
|
| + if (!window())
|
| + return;
|
| +
|
| +#if defined(OS_CHROMEOS)
|
| + // Don't show content browser for extension/theme downloads from gallery.
|
| + if (download->is_extension_install()) {
|
| + ExtensionService* service = profile_->GetExtensionService();
|
| + if (service && service->IsDownloadFromGallery(download->url(),
|
| + download->referrer_url())) {
|
| + return;
|
| + }
|
| + }
|
| + // Open the Active Downloads ui for chromeos.
|
| + ActiveDownloadsUI::OpenPopup(profile_);
|
| +#else
|
| + // GetDownloadShelf creates the download shelf if it was not yet created.
|
| + window()->GetDownloadShelf()->AddDownload(new DownloadItemModel(download));
|
| +
|
| + // Don't show the animation for "Save file" downloads.
|
| + if (download->total_bytes() <= 0)
|
| + return;
|
| +
|
| + // For non-theme extensions, we don't show the download animation.
|
| + if (download->is_extension_install() &&
|
| + !ExtensionService::IsDownloadFromMiniGallery(download->url()))
|
| + return;
|
| +
|
| + TabContents* current_tab = GetSelectedTabContents();
|
| + // We make this check for the case of minimized windows, unit tests, etc.
|
| + if (platform_util::IsVisible(current_tab->GetNativeView()) &&
|
| + ui::Animation::ShouldRenderRichAnimation()) {
|
| + DownloadStartedAnimation::Show(current_tab);
|
| + }
|
| +#endif
|
| +
|
| + // If the download occurs in a new tab, close it.
|
| + TabContentsWrapper* wrapper =
|
| + TabContentsWrapper::GetCurrentWrapperForContents(tab);
|
| + if (tab->controller().IsInitialNavigation() &&
|
| + GetConstrainingContentsWrapper(wrapper) == wrapper && tab_count() > 1) {
|
| + CloseContents(tab);
|
| + }
|
| +}
|
| +
|
| void Browser::ShowPageInfo(Profile* profile,
|
| const GURL& url,
|
| const NavigationEntry::SSLStatus& ssl,
|
| @@ -3438,56 +3483,6 @@
|
| }
|
|
|
| ///////////////////////////////////////////////////////////////////////////////
|
| -// Browser, DownloadTabHelperDelegate implementation:
|
| -
|
| -bool Browser::CanDownload(int request_id) {
|
| - return true;
|
| -}
|
| -
|
| -void Browser::OnStartDownload(DownloadItem* download, TabContentsWrapper* tab) {
|
| - if (!window())
|
| - return;
|
| -
|
| -#if defined(OS_CHROMEOS)
|
| - // Don't show content browser for extension/theme downloads from gallery.
|
| - if (download->is_extension_install()) {
|
| - ExtensionService* service = profile_->GetExtensionService();
|
| - if (service && service->IsDownloadFromGallery(download->url(),
|
| - download->referrer_url())) {
|
| - return;
|
| - }
|
| - }
|
| - // Open the Active Downloads ui for chromeos.
|
| - ActiveDownloadsUI::OpenPopup(profile_);
|
| -#else
|
| - // GetDownloadShelf creates the download shelf if it was not yet created.
|
| - window()->GetDownloadShelf()->AddDownload(new DownloadItemModel(download));
|
| -
|
| - // Don't show the animation for "Save file" downloads.
|
| - if (download->total_bytes() <= 0)
|
| - return;
|
| -
|
| - // For non-theme extensions, we don't show the download animation.
|
| - if (download->is_extension_install() &&
|
| - !ExtensionService::IsDownloadFromMiniGallery(download->url()))
|
| - return;
|
| -
|
| - TabContents* current_tab = GetSelectedTabContents();
|
| - // We make this check for the case of minimized windows, unit tests, etc.
|
| - if (platform_util::IsVisible(current_tab->GetNativeView()) &&
|
| - ui::Animation::ShouldRenderRichAnimation()) {
|
| - DownloadStartedAnimation::Show(current_tab);
|
| - }
|
| -#endif
|
| -
|
| - // If the download occurs in a new tab, close it.
|
| - if (tab->tab_contents()->controller().IsInitialNavigation() &&
|
| - GetConstrainingContentsWrapper(tab) == tab && tab_count() > 1) {
|
| - CloseContents(tab->tab_contents());
|
| - }
|
| -}
|
| -
|
| -///////////////////////////////////////////////////////////////////////////////
|
| // Browser, SelectFileDialog::Listener implementation:
|
|
|
| void Browser::FileSelected(const FilePath& path, int index, void* params) {
|
| @@ -4397,7 +4392,6 @@
|
| // ...and all the helpers.
|
| tab->blocked_content_tab_helper()->set_delegate(delegate);
|
| tab->bookmark_tab_helper()->set_delegate(delegate);
|
| - tab->download_tab_helper()->set_delegate(delegate);
|
| tab->search_engine_tab_helper()->set_delegate(delegate);
|
| }
|
|
|
|
|