diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-04 03:30:22 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-04 03:30:22 +0000 |
commit | 59560e0ba999d5edc33453d4a0fbf44831025817 (patch) | |
tree | f365944f6f0eca593a28747a7fed4caf169578fb /chrome/browser/browser.cc | |
parent | 4d2868972ff25746d39ecea58e88480ae0463145 (diff) | |
download | chromium_src-59560e0ba999d5edc33453d4a0fbf44831025817.zip chromium_src-59560e0ba999d5edc33453d4a0fbf44831025817.tar.gz chromium_src-59560e0ba999d5edc33453d4a0fbf44831025817.tar.bz2 |
Move download shelf from per-tab to per-window. Also disable auto-hiding of
the shelf.
BUG=9025
TEST=Download file in one tab, open new tab, and check that download shelf is
still open. Also try the shelf's close button and the "show all downloads"
link. When saving a file, the download animation should not show up.
Review URL: http://codereview.chromium.org/115740
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17595 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser.cc')
-rw-r--r-- | chrome/browser/browser.cc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 92c8ab6..fe99bdd 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -18,7 +18,10 @@ #include "chrome/browser/character_encoding.h" #include "chrome/browser/debugger/debugger_host.h" #include "chrome/browser/debugger/devtools_manager.h" +#include "chrome/browser/download/download_item_model.h" #include "chrome/browser/download/download_manager.h" +#include "chrome/browser/download/download_shelf.h" +#include "chrome/browser/download/download_started_animation.h" #include "chrome/browser/find_bar.h" #include "chrome/browser/find_bar_controller.h" #include "chrome/browser/location_bar.h" @@ -42,6 +45,7 @@ #include "chrome/common/extensions/extension.h" #include "chrome/common/notification_service.h" #include "chrome/common/page_transition_types.h" +#include "chrome/common/platform_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" #include "chrome/common/url_constants.h" @@ -1153,6 +1157,25 @@ void Browser::OpenHelpTab() { false, NULL); } +void Browser::OnStartDownload(DownloadItem* download) { + if (!window()) + return; + + // GetDownloadShelf creates the download shelf if it was not yet created. + window()->GetDownloadShelf()->AddDownload(new DownloadItemModel(download)); + +// TODO(port): port for mac. +#if defined(OS_WIN) || defined(OS_LINUX) + // Don't show the animation for "Save file" downloads. + if (download->total_bytes() > 0) { + TabContents* current_tab = GetSelectedTabContents(); + // We make this check for the case of minimized windows, unit tests, etc. + if (platform_util::IsVisible(current_tab->GetNativeView())) + DownloadStartedAnimation::Show(current_tab); + } +#endif +} + /////////////////////////////////////////////////////////////////////////////// // static |