OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #endif // OS_WIN | 10 #endif // OS_WIN |
(...skipping 3630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3641 if (!window()) | 3641 if (!window()) |
3642 return; | 3642 return; |
3643 | 3643 |
3644 if (DisplayOldDownloadsUI()) { | 3644 if (DisplayOldDownloadsUI()) { |
3645 #if defined(OS_CHROMEOS) && !defined(USE_AURA) | 3645 #if defined(OS_CHROMEOS) && !defined(USE_AURA) |
3646 // Don't show content browser for extension/theme downloads from gallery. | 3646 // Don't show content browser for extension/theme downloads from gallery. |
3647 ExtensionService* service = profile_->GetExtensionService(); | 3647 ExtensionService* service = profile_->GetExtensionService(); |
3648 if (!ChromeDownloadManagerDelegate::IsExtensionDownload(download) || | 3648 if (!ChromeDownloadManagerDelegate::IsExtensionDownload(download) || |
3649 (service == NULL) || | 3649 (service == NULL) || |
3650 !service->IsDownloadFromGallery(download->GetURL(), | 3650 !service->IsDownloadFromGallery(download->GetURL(), |
3651 download->referrer_url())) { | 3651 download->GetReferrerUrl())) { |
3652 // Open the Active Downloads ui for chromeos. | 3652 // Open the Active Downloads ui for chromeos. |
3653 ActiveDownloadsUI::OpenPopup(profile_); | 3653 ActiveDownloadsUI::OpenPopup(profile_); |
3654 } | 3654 } |
3655 #else | 3655 #else |
3656 // GetDownloadShelf creates the download shelf if it was not yet created. | 3656 // GetDownloadShelf creates the download shelf if it was not yet created. |
3657 DownloadShelf* shelf = window()->GetDownloadShelf(); | 3657 DownloadShelf* shelf = window()->GetDownloadShelf(); |
3658 shelf->AddDownload(new DownloadItemModel(download)); | 3658 shelf->AddDownload(new DownloadItemModel(download)); |
3659 // Don't show the animation for "Save file" downloads. | 3659 // Don't show the animation for "Save file" downloads. |
3660 // For non-theme extensions, we don't show the download animation. | 3660 // For non-theme extensions, we don't show the download animation. |
3661 // Show animation in same window as the download shelf. Download shelf | 3661 // Show animation in same window as the download shelf. Download shelf |
3662 // may not be in the same window that initiated the download, e.g. | 3662 // may not be in the same window that initiated the download, e.g. |
3663 // Panels. | 3663 // Panels. |
3664 // Don't show the animation if the selected tab is not visible (i.e. the | 3664 // Don't show the animation if the selected tab is not visible (i.e. the |
3665 // window is minimized, we're in a unit test, etc.). | 3665 // window is minimized, we're in a unit test, etc.). |
3666 TabContents* shelf_tab = shelf->browser()->GetSelectedTabContents(); | 3666 TabContents* shelf_tab = shelf->browser()->GetSelectedTabContents(); |
3667 if ((download->total_bytes() > 0) && | 3667 if ((download->GetTotalBytes() > 0) && |
3668 !ChromeDownloadManagerDelegate::IsExtensionDownload(download) && | 3668 !ChromeDownloadManagerDelegate::IsExtensionDownload(download) && |
3669 platform_util::IsVisible(shelf_tab->GetNativeView()) && | 3669 platform_util::IsVisible(shelf_tab->GetNativeView()) && |
3670 ui::Animation::ShouldRenderRichAnimation()) { | 3670 ui::Animation::ShouldRenderRichAnimation()) { |
3671 DownloadStartedAnimation::Show(shelf_tab); | 3671 DownloadStartedAnimation::Show(shelf_tab); |
3672 } | 3672 } |
3673 #endif | 3673 #endif |
3674 } | 3674 } |
3675 | 3675 |
3676 // If the download occurs in a new tab, close it. | 3676 // If the download occurs in a new tab, close it. |
3677 if (source->controller().IsInitialNavigation() && tab_count() > 1) | 3677 if (source->controller().IsInitialNavigation() && tab_count() > 1) |
(...skipping 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5272 window_->GetLocationBar()->ShowFirstRunBubble(bubble_type); | 5272 window_->GetLocationBar()->ShowFirstRunBubble(bubble_type); |
5273 } else if (is_type_tabbed()) { | 5273 } else if (is_type_tabbed()) { |
5274 GlobalErrorService* service = | 5274 GlobalErrorService* service = |
5275 GlobalErrorServiceFactory::GetForProfile(profile()); | 5275 GlobalErrorServiceFactory::GetForProfile(profile()); |
5276 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); | 5276 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); |
5277 if (error) { | 5277 if (error) { |
5278 error->ShowBubbleView(this); | 5278 error->ShowBubbleView(this); |
5279 } | 5279 } |
5280 } | 5280 } |
5281 } | 5281 } |
OLD | NEW |