diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-04 22:19:41 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-04 22:19:41 +0000 |
commit | 3edd952ea05dfb5c950b63768fc9cc9ec807f6d8 (patch) | |
tree | a78e9bef8fe0efbff8b56fb6c6f8bc23e344c46e /chrome/browser/tab_contents | |
parent | c0a2ee2bb8bfcc3ade688d43a95cc3404eea3748 (diff) | |
download | chromium_src-3edd952ea05dfb5c950b63768fc9cc9ec807f6d8.zip chromium_src-3edd952ea05dfb5c950b63768fc9cc9ec807f6d8.tar.gz chromium_src-3edd952ea05dfb5c950b63768fc9cc9ec807f6d8.tar.bz2 |
Basic download shelf implementation on linux.
It shows and hides at appropriate times, and that's about it.
TEST=navigate to a savable page and select "save page as" from the page menu. Click the x. Save the page again. The shelf should pop up, go away, pop up again.
Review URL: http://codereview.chromium.org/38004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10927 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tab_contents')
-rw-r--r-- | chrome/browser/tab_contents/tab_contents.cc | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc index 7905364..1df337c 100644 --- a/chrome/browser/tab_contents/tab_contents.cc +++ b/chrome/browser/tab_contents/tab_contents.cc @@ -464,6 +464,13 @@ void TabContents::RemoveInfoBar(InfoBarDelegate* delegate) { } } } +#endif // defined(OS_WIN) + +void TabContents::ToolbarSizeChanged(bool is_animating) { + TabContentsDelegate* d = delegate(); + if (d) + d->ToolbarSizeChanged(this, is_animating); +} void TabContents::SetDownloadShelfVisible(bool visible) { if (shelf_visible_ != visible) { @@ -483,32 +490,33 @@ void TabContents::SetDownloadShelfVisible(bool visible) { ToolbarSizeChanged(false); } -void TabContents::ToolbarSizeChanged(bool is_animating) { - TabContentsDelegate* d = delegate(); - if (d) - d->ToolbarSizeChanged(this, is_animating); -} - +#if defined(OS_WIN) || defined(OS_LINUX) void TabContents::OnStartDownload(DownloadItem* download) { DCHECK(download); TabContents* tab_contents = this; +// TODO(port): port contraining contents. +#if defined(OS_WIN) // Download in a constrained popup is shown in the tab that opened it. TabContents* constraining_tab = delegate()->GetConstrainingContents(this); if (constraining_tab) tab_contents = constraining_tab; +#endif // GetDownloadShelf creates the download shelf if it was not yet created. tab_contents->GetDownloadShelf()->AddDownload( new DownloadItemModel(download)); tab_contents->SetDownloadShelfVisible(true); +// TODO(port): port animatinos. +#if defined(OS_WIN) // This animation will delete itself when it finishes, or if we become hidden // or destroyed. if (IsWindowVisible(GetNativeView())) { // For minimized windows, unit // tests, etc. new DownloadStartedAnimation(tab_contents); } +#endif } DownloadShelf* TabContents::GetDownloadShelf() { @@ -523,6 +531,20 @@ void TabContents::MigrateShelfFrom(TabContents* tab_contents) { tab_contents->ReleaseDownloadShelf(); } +void TabContents::ReleaseDownloadShelf() { + download_shelf_.release(); +} + +// static +void TabContents::MigrateShelf(TabContents* from, TabContents* to) { + bool was_shelf_visible = from->IsDownloadShelfVisible(); + if (was_shelf_visible) + to->MigrateShelfFrom(from); + to->SetDownloadShelfVisible(was_shelf_visible); +} +#endif // defined(OS_WIN) || defined(OS_LINUX) + +#if defined(OS_WIN) void TabContents::WillClose(ConstrainedWindow* window) { ConstrainedWindowList::iterator it = find(child_windows_.begin(), child_windows_.end(), window); @@ -555,14 +577,6 @@ void TabContents::Observe(NotificationType type, ExpireInfoBars(committed_details); } -// static -void TabContents::MigrateShelf(TabContents* from, TabContents* to) { - bool was_shelf_visible = from->IsDownloadShelfVisible(); - if (was_shelf_visible) - to->MigrateShelfFrom(from); - to->SetDownloadShelfVisible(was_shelf_visible); -} - void TabContents::SetIsLoading(bool is_loading, LoadNotificationDetails* details) { if (is_loading == is_loading_) @@ -604,10 +618,6 @@ void TabContents::RepositionSupressedPopupsToFit(const gfx::Size& new_size) { blocked_popups_->RepositionConstrainedWindowTo(anchor_position); } -void TabContents::ReleaseDownloadShelf() { - download_shelf_.release(); -} - bool TabContents::ShowingBlockedPopupNotification() const { return blocked_popups_ != NULL && blocked_popups_->GetTabContentsCount() != 0; |