Chromium Code Reviews| Index: chrome/browser/ui/browser.cc |
| diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc |
| index 0c8c5e65f25b9893efbb74b76db810e5d525d2c3..0999f146c346fe7266cc57871496f74fea657bde 100644 |
| --- a/chrome/browser/ui/browser.cc |
| +++ b/chrome/browser/ui/browser.cc |
| @@ -3379,41 +3379,43 @@ void Browser::OnStartDownload(TabContents* source, DownloadItem* download) { |
| if (!window()) |
| return; |
| + if (!CommandLine::ForCurrentProcess()->HasSwitch( |
|
cbentzel
2011/08/11 20:08:29
I'd rather wrap this in a helper function such as
benjhayden
2011/08/15 14:57:15
Done.
|
| + switches::kDownloadsNewUI)) { |
| #if defined(OS_CHROMEOS) |
| - // Don't show content browser for extension/theme downloads from gallery. |
| - if (download->is_extension_install()) { |
| + // Don't show content browser for extension/theme downloads from gallery. |
| ExtensionService* service = profile_->GetExtensionService(); |
| - if (service && service->IsDownloadFromGallery(download->GetURL(), |
| - download->referrer_url())) { |
| - return; |
| + if (!download->is_extension_install() || |
| + (service == NULL) || |
| + !service->IsDownloadFromGallery(download->GetURL(), |
| + download->referrer_url())) { |
| + // Open the Active Downloads ui for chromeos. |
| + ActiveDownloadsUI::OpenPopup(profile_); |
| } |
| - } |
| - // Open the Active Downloads ui for chromeos. |
| - ActiveDownloadsUI::OpenPopup(profile_); |
| #else |
| - // GetDownloadShelf creates the download shelf if it was not yet created. |
| - DownloadShelf* shelf = window()->GetDownloadShelf(); |
| - shelf->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->GetURL())) |
| - return; |
| - |
| - // Show animation in same window as the download shelf. Download shelf |
| - // may not be in the same window that initiated the download, e.g. Panels. |
| - TabContents* shelf_tab = shelf->browser()->GetSelectedTabContents(); |
| - |
| - // We make this check for the case of minimized windows, unit tests, etc. |
| - if (platform_util::IsVisible(shelf_tab->GetNativeView()) && |
| - ui::Animation::ShouldRenderRichAnimation()) { |
| - DownloadStartedAnimation::Show(shelf_tab); |
| - } |
| + // GetDownloadShelf creates the download shelf if it was not yet created. |
| + DownloadShelf* shelf = window()->GetDownloadShelf(); |
| + shelf->AddDownload(new DownloadItemModel(download)); |
| + |
| + // Don't show the animation for "Save file" downloads. |
| + if (download->total_bytes() > 0) { |
| + // For non-theme extensions, we don't show the download animation. |
| + if (!download->is_extension_install() || |
| + ExtensionService::IsDownloadFromMiniGallery(download->GetURL())) { |
| + // Show animation in same window as the download shelf. Download shelf |
| + // may not be in the same window that initiated the download, e.g. |
| + // Panels. |
| + TabContents* shelf_tab = shelf->browser()->GetSelectedTabContents(); |
| + |
| + // We make this check for the case of minimized windows, unit tests, |
| + // etc. |
| + if (platform_util::IsVisible(shelf_tab->GetNativeView()) && |
| + ui::Animation::ShouldRenderRichAnimation()) { |
| + DownloadStartedAnimation::Show(shelf_tab); |
| + } |
| + } |
| + } |
| #endif |
| + } |
| // If the download occurs in a new tab, close it. |
| if (source->controller().IsInitialNavigation() && tab_count() > 1) |