Skip to content

Commit

Permalink
Revert 170071 - Split window_animations, moving basic animations to v…
Browse files Browse the repository at this point in the history
…iews/corewm.

The base definition of the animation type enum also moves to corewm, and the API now allows downstream libraries (like ash) to extend the set of animations available.

This will allow us to more easily use "core" animations in desktop-aura.

I also removed the internal namespace from window_animations that remained in ash, since the use of namespaces in that file had begun to confuse me.

http://crbug.com/158115
R=sky@chromium.org
Review URL: https://codereview.chromium.org/11412223

TBR=ben@chromium.org

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170084 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
ben@chromium.org committed Nov 28, 2012
1 parent 8b4a61a commit 92b18e9
Show file tree
Hide file tree
Showing 33 changed files with 683 additions and 1,001 deletions.
17 changes: 9 additions & 8 deletions ash/desktop_background/desktop_background_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -191,19 +191,20 @@ views::Widget* CreateDesktopBackground(aura::RootWindow* root_window,
params.parent = root_window->GetChildById(container_id);
desktop_widget->Init(params);
desktop_widget->SetContentsView(new DesktopBackgroundView());
int animation_type = wallpaper_delegate->GetAnimationType();
views::corewm::SetWindowVisibilityAnimationType(
desktop_widget->GetNativeView(), animation_type);
ash::WindowVisibilityAnimationType animation_type =
wallpaper_delegate->GetAnimationType();
ash::SetWindowVisibilityAnimationType(desktop_widget->GetNativeView(),
animation_type);
// Disable animation when creating the first widget. Otherwise, wallpaper
// will animate from a white screen. Note that boot animation is different.
// It animates from a white background.
if (animation_type == views::corewm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE &&
if (animation_type == ash::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE &&
root_window->GetProperty(kAnimatingDesktopController) == NULL) {
views::corewm::SetWindowVisibilityAnimationTransition(
desktop_widget->GetNativeView(), views::corewm::ANIMATE_NONE);
ash::SetWindowVisibilityAnimationTransition(desktop_widget->GetNativeView(),
ash::ANIMATE_NONE);
} else {
views::corewm::SetWindowVisibilityAnimationTransition(
desktop_widget->GetNativeView(), views::corewm::ANIMATE_SHOW);
ash::SetWindowVisibilityAnimationTransition(desktop_widget->GetNativeView(),
ash::ANIMATE_SHOW);
}
desktop_widget->SetBounds(params.parent->bounds());
ui::ScopedLayerAnimationSettings settings(
Expand Down
4 changes: 2 additions & 2 deletions ash/desktop_background/user_wallpaper_delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#define ASH_DESKTOP_BACKGROUND_USER_WALLPAPER_DELEGATE_H_

#include "ash/ash_export.h"
#include "ui/views/corewm/window_animations.h"
#include "ash/wm/window_animations.h"

namespace ash {

Expand All @@ -16,7 +16,7 @@ class ASH_EXPORT UserWallpaperDelegate {

// Returns the type of window animation that should be used when showing the
// wallpaper.
virtual int GetAnimationType() = 0;
virtual WindowVisibilityAnimationType GetAnimationType() = 0;

// Should the slower initial animation be shown (as opposed to the faster
// animation that's used e.g. when switching from one user's wallpaper to
Expand Down
10 changes: 4 additions & 6 deletions ash/launcher/launcher_tooltip_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,7 @@ void LauncherTooltipManager::CancelHidingAnimation() {
return;

gfx::NativeView native_view = widget_->GetNativeView();
views::corewm::SetWindowVisibilityAnimationTransition(
native_view, views::corewm::ANIMATE_NONE);
SetWindowVisibilityAnimationTransition(native_view, ANIMATE_NONE);
}

void LauncherTooltipManager::CloseSoon() {
Expand Down Expand Up @@ -377,10 +376,9 @@ void LauncherTooltipManager::CreateBubble(views::View* anchor,
view_->SetText(text_);

gfx::NativeView native_view = widget_->GetNativeView();
views::corewm::SetWindowVisibilityAnimationType(
native_view, views::corewm::WINDOW_VISIBILITY_ANIMATION_TYPE_VERTICAL);
views::corewm::SetWindowVisibilityAnimationTransition(
native_view, views::corewm::ANIMATE_HIDE);
SetWindowVisibilityAnimationType(
native_view, WINDOW_VISIBILITY_ANIMATION_TYPE_VERTICAL);
SetWindowVisibilityAnimationTransition(native_view, ANIMATE_HIDE);
}

} // namespace internal
Expand Down
4 changes: 2 additions & 2 deletions ash/shell.cc
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ class DummyUserWallpaperDelegate : public UserWallpaperDelegate {

virtual ~DummyUserWallpaperDelegate() {}

virtual int GetAnimationType() OVERRIDE {
return views::corewm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE;
virtual ash::WindowVisibilityAnimationType GetAnimationType() OVERRIDE {
return WINDOW_VISIBILITY_ANIMATION_TYPE_FADE;
}

virtual bool ShouldShowInitialAnimation() OVERRIDE {
Expand Down
10 changes: 5 additions & 5 deletions ash/system/tray/tray_background_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -288,13 +288,13 @@ void TrayBackgroundView::SetBorder() {

void TrayBackgroundView::InitializeBubbleAnimations(
views::Widget* bubble_widget) {
views::corewm::SetWindowVisibilityAnimationType(
ash::SetWindowVisibilityAnimationType(
bubble_widget->GetNativeWindow(),
views::corewm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE);
views::corewm::SetWindowVisibilityAnimationTransition(
ash::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE);
ash::SetWindowVisibilityAnimationTransition(
bubble_widget->GetNativeWindow(),
views::corewm::ANIMATE_HIDE);
views::corewm::SetWindowVisibilityAnimationDuration(
ash::ANIMATE_HIDE);
ash::SetWindowVisibilityAnimationDuration(
bubble_widget->GetNativeWindow(),
base::TimeDelta::FromMilliseconds(kAnimationDurationForPopupMS));
}
Expand Down
3 changes: 1 addition & 2 deletions ash/wm/base_layout_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "ui/base/ui_base_types.h"
#include "ui/compositor/layer.h"
#include "ui/gfx/screen.h"
#include "ui/views/corewm/window_util.h"

namespace ash {
namespace internal {
Expand Down Expand Up @@ -154,7 +153,7 @@ void BaseLayoutManager::ShowStateChanged(aura::Window* window,
if (wm::IsWindowMinimized(window)) {
// Save the previous show state so that we can correctly restore it.
window->SetProperty(internal::kRestoreShowStateKey, last_show_state);
views::corewm::SetWindowVisibilityAnimationType(
SetWindowVisibilityAnimationType(
window, WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE);

// Hide the window.
Expand Down
2 changes: 1 addition & 1 deletion ash/wm/system_modal_container_layout_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ void SystemModalContainerLayoutManager::DestroyModalBackground() {
ui::ScopedLayerAnimationSettings settings(
modal_background_->GetNativeView()->layer()->GetAnimator());
modal_background_->Close();
settings.AddObserver(views::corewm::CreateHidingWindowAnimationObserver(
settings.AddObserver(CreateHidingWindowAnimationObserver(
modal_background_->GetNativeView()));
modal_background_->GetNativeView()->layer()->SetOpacity(0.0f);
modal_background_ = NULL;
Expand Down
Loading

0 comments on commit 92b18e9

Please sign in to comment.