diff options
33 files changed, 683 insertions, 1001 deletions
diff --git a/ash/desktop_background/desktop_background_view.cc b/ash/desktop_background/desktop_background_view.cc index 3590853..86175a4 100644 --- a/ash/desktop_background/desktop_background_view.cc +++ b/ash/desktop_background/desktop_background_view.cc @@ -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( diff --git a/ash/desktop_background/user_wallpaper_delegate.h b/ash/desktop_background/user_wallpaper_delegate.h index 440d284..15c6d62 100644 --- a/ash/desktop_background/user_wallpaper_delegate.h +++ b/ash/desktop_background/user_wallpaper_delegate.h @@ -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 { @@ -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 diff --git a/ash/launcher/launcher_tooltip_manager.cc b/ash/launcher/launcher_tooltip_manager.cc index 4263bd6..047aabf 100644 --- a/ash/launcher/launcher_tooltip_manager.cc +++ b/ash/launcher/launcher_tooltip_manager.cc @@ -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() { @@ -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 diff --git a/ash/shell.cc b/ash/shell.cc index 57193ed..2a8e895 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -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 { diff --git a/ash/system/tray/tray_background_view.cc b/ash/system/tray/tray_background_view.cc index f32271a..7ec4ed1 100644 --- a/ash/system/tray/tray_background_view.cc +++ b/ash/system/tray/tray_background_view.cc @@ -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)); } diff --git a/ash/wm/base_layout_manager.cc b/ash/wm/base_layout_manager.cc index 770a609..166bc54 100644 --- a/ash/wm/base_layout_manager.cc +++ b/ash/wm/base_layout_manager.cc @@ -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 { @@ -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. diff --git a/ash/wm/system_modal_container_layout_manager.cc b/ash/wm/system_modal_container_layout_manager.cc index 45cd204..e6976ab 100644 --- a/ash/wm/system_modal_container_layout_manager.cc +++ b/ash/wm/system_modal_container_layout_manager.cc @@ -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; diff --git a/ash/wm/window_animations.cc b/ash/wm/window_animations.cc index d35e465..33546ae 100644 --- a/ash/wm/window_animations.cc +++ b/ash/wm/window_animations.cc @@ -35,12 +35,40 @@ #include "ui/gfx/interpolated_transform.h" #include "ui/gfx/screen.h" #include "ui/gfx/vector3d_f.h" -#include "ui/views/corewm/window_util.h" #include "ui/views/view.h" #include "ui/views/widget/widget.h" +DECLARE_WINDOW_PROPERTY_TYPE(int) +DECLARE_WINDOW_PROPERTY_TYPE(ash::WindowVisibilityAnimationType) +DECLARE_WINDOW_PROPERTY_TYPE(ash::WindowVisibilityAnimationTransition) +DECLARE_WINDOW_PROPERTY_TYPE(float) +DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(ASH_EXPORT, bool) + +using aura::Window; +using base::TimeDelta; +using ui::Layer; + namespace ash { +namespace internal { +namespace { +const float kWindowAnimation_Vertical_TranslateY = 15.f; + +} // namespace + +DEFINE_WINDOW_PROPERTY_KEY(WindowVisibilityAnimationType, + kWindowVisibilityAnimationTypeKey, + WINDOW_VISIBILITY_ANIMATION_TYPE_DEFAULT); +DEFINE_WINDOW_PROPERTY_KEY(int, kWindowVisibilityAnimationDurationKey, 0); +DEFINE_WINDOW_PROPERTY_KEY(WindowVisibilityAnimationTransition, + kWindowVisibilityAnimationTransitionKey, + ANIMATE_BOTH); +DEFINE_WINDOW_PROPERTY_KEY(float, + kWindowVisibilityAnimationVerticalPositionKey, + kWindowAnimation_Vertical_TranslateY); + namespace { + +const int kDefaultAnimationDurationForMenuMS = 150; const int kLayerAnimationsForMinimizeDurationMS = 200; // Durations for the cross-fade animation, in milliseconds. @@ -56,9 +84,22 @@ const float kWindowAnimation_ShowBrightnessGrayscale = 0.f; const float kWindowAnimation_HideOpacity = 0.f; const float kWindowAnimation_ShowOpacity = 1.f; +const float kWindowAnimation_TranslateFactor = 0.025f; +const float kWindowAnimation_ScaleFactor = .95f; // TODO(sky): if we end up sticking with 0, nuke the code doing the rotation. const float kWindowAnimation_MinimizeRotate = 0.f; +const int kWindowAnimation_Rotate_DurationMS = 180; +const int kWindowAnimation_Rotate_OpacityDurationPercent = 90; +const float kWindowAnimation_Rotate_TranslateY = -20.f; +const float kWindowAnimation_Rotate_PerspectiveDepth = 500.f; +const float kWindowAnimation_Rotate_DegreesX = 5.f; +const float kWindowAnimation_Rotate_ScaleFactor = .99f; + +const float kWindowAnimation_Bounce_Scale = 1.02f; +const int kWindowAnimation_Bounce_DurationMS = 180; +const int kWindowAnimation_Bounce_GrowShrinkDurationPercent = 40; + // Tween type when cross fading a workspace window. const ui::Tween::Type kCrossFadeTweenType = ui::Tween::EASE_IN_OUT; @@ -66,6 +107,223 @@ int64 Round64(float f) { return static_cast<int64>(f + 0.5f); } +base::TimeDelta GetWindowVisibilityAnimationDuration(aura::Window* window) { + int duration = + window->GetProperty(kWindowVisibilityAnimationDurationKey); + if (duration == 0 && window->type() == aura::client::WINDOW_TYPE_MENU) { + return base::TimeDelta::FromMilliseconds( + kDefaultAnimationDurationForMenuMS); + } + return TimeDelta::FromInternalValue(duration); +} + +bool HasWindowVisibilityAnimationTransition( + aura::Window* window, + WindowVisibilityAnimationTransition transition) { + WindowVisibilityAnimationTransition prop = window->GetProperty( + kWindowVisibilityAnimationTransitionKey); + return (prop & transition) != 0; +} + +// Gets/sets the WindowVisibilityAnimationType associated with a window. +WindowVisibilityAnimationType GetWindowVisibilityAnimationType( + aura::Window* window) { + WindowVisibilityAnimationType type = + window->GetProperty(kWindowVisibilityAnimationTypeKey); + if (type == WINDOW_VISIBILITY_ANIMATION_TYPE_DEFAULT) { + return (window->type() == aura::client::WINDOW_TYPE_MENU || + window->type() == aura::client::WINDOW_TYPE_TOOLTIP) ? + WINDOW_VISIBILITY_ANIMATION_TYPE_FADE : + WINDOW_VISIBILITY_ANIMATION_TYPE_DROP; + } + return type; +} + +// Observes a hide animation. +// A window can be hidden for a variety of reasons. Sometimes, Hide() will be +// called and life is simple. Sometimes, the window is actually bound to a +// views::Widget and that Widget is closed, and life is a little more +// complicated. When a Widget is closed the aura::Window* is actually not +// destroyed immediately - it is actually just immediately hidden and then +// destroyed when the stack unwinds. To handle this case, we start the hide +// animation immediately when the window is hidden, then when the window is +// subsequently destroyed this object acquires ownership of the window's layer, +// so that it can continue animating it until the animation completes. +// Regardless of whether or not the window is destroyed, this object deletes +// itself when the animation completes. +class HidingWindowAnimationObserver : public ui::ImplicitAnimationObserver, + public aura::WindowObserver { + public: + explicit HidingWindowAnimationObserver(aura::Window* window) + : window_(window) { + window_->AddObserver(this); + } + virtual ~HidingWindowAnimationObserver() { + STLDeleteElements(&layers_); + } + + private: + // Overridden from ui::ImplicitAnimationObserver: + virtual void OnImplicitAnimationsCompleted() OVERRIDE { + // Window may have been destroyed by this point. + if (window_) + window_->RemoveObserver(this); + delete this; + } + + // Overridden from aura::WindowObserver: + virtual void OnWindowDestroying(aura::Window* window) OVERRIDE { + DCHECK_EQ(window, window_); + DCHECK(layers_.empty()); + AcquireAllLayers(window_); + + // If the Widget has views with layers, then it is necessary to take + // ownership of those layers too. + views::Widget* widget = views::Widget::GetWidgetForNativeWindow(window_); + const views::Widget* const_widget = widget; + if (widget && const_widget->GetRootView() && widget->GetContentsView()) + AcquireAllViewLayers(widget->GetContentsView()); + window_->RemoveObserver(this); + window_ = NULL; + } + + void AcquireAllLayers(aura::Window* window) { + ui::Layer* layer = window->AcquireLayer(); + DCHECK(layer); + layers_.push_back(layer); + for (aura::Window::Windows::const_iterator it = window->children().begin(); + it != window->children().end(); + ++it) + AcquireAllLayers(*it); + } + + void AcquireAllViewLayers(views::View* view) { + for (int i = 0; i < view->child_count(); ++i) + AcquireAllViewLayers(view->child_at(i)); + if (view->layer()) { + ui::Layer* layer = view->RecreateLayer(); + if (layer) { + layer->SuppressPaint(); + layers_.push_back(layer); + } + } + } + + aura::Window* window_; + std::vector<ui::Layer*> layers_; + + DISALLOW_COPY_AND_ASSIGN(HidingWindowAnimationObserver); +}; + +// ImplicitAnimationObserver used when switching workspaces. Resets the layer +// visibility to 'false' when done. This doesn't need the complexity of +// HidingWindowAnimationObserver as the window isn't closing, and if it does a +// HidingWindowAnimationObserver will be created. +class WorkspaceHidingWindowAnimationObserver + : public ui::ImplicitAnimationObserver { + public: + explicit WorkspaceHidingWindowAnimationObserver(aura::Window* window) + : layer_(window->layer()) { + } + virtual ~WorkspaceHidingWindowAnimationObserver() { + } + + private: + // Overridden from ui::ImplicitAnimationObserver: + virtual void OnImplicitAnimationsCompleted() OVERRIDE { + // Restore the correct visibility value (overridden for the duration of the + // animation in AnimateHideWindow()). + layer_->SetVisible(false); + delete this; + } + + ui::Layer* layer_; + + DISALLOW_COPY_AND_ASSIGN(WorkspaceHidingWindowAnimationObserver); +}; + +// Shows a window using an animation, animating its opacity from 0.f to 1.f, +// its visibility to true, and its transform from |start_transform| to +// |end_transform|. +void AnimateShowWindowCommon(aura::Window* window, + const gfx::Transform& start_transform, + const gfx::Transform& end_transform) { + window->layer()->set_delegate(window); + window->layer()->SetOpacity(kWindowAnimation_HideOpacity); + window->layer()->SetTransform(start_transform); + window->layer()->SetVisible(true); + + { + // Property sets within this scope will be implicitly animated. + ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator()); + base::TimeDelta duration = GetWindowVisibilityAnimationDuration(window); + if (duration.ToInternalValue() > 0) + settings.SetTransitionDuration(duration); + + window->layer()->SetTransform(end_transform); + window->layer()->SetOpacity(kWindowAnimation_ShowOpacity); + } +} + +// Hides a window using an animation, animating its opacity from 1.f to 0.f, +// its visibility to false, and its transform to |end_transform|. +void AnimateHideWindowCommon(aura::Window* window, + const gfx::Transform& end_transform) { + window->layer()->set_delegate(NULL); + + // Property sets within this scope will be implicitly animated. + ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator()); + settings.AddObserver(new HidingWindowAnimationObserver(window)); + + base::TimeDelta duration = GetWindowVisibilityAnimationDuration(window); + if (duration.ToInternalValue() > 0) + settings.SetTransitionDuration(duration); + + window->layer()->SetOpacity(kWindowAnimation_HideOpacity); + window->layer()->SetTransform(end_transform); + window->layer()->SetVisible(false); +} + +static gfx::Transform GetScaleForWindow(aura::Window* window) { + gfx::Rect bounds = window->bounds(); + gfx::Transform scale = gfx::GetScaleTransform( + gfx::Point(kWindowAnimation_TranslateFactor * bounds.width(), + kWindowAnimation_TranslateFactor * bounds.height()), + kWindowAnimation_ScaleFactor); + return scale; +} + +// Show/Hide windows using a shrink animation. +void AnimateShowWindow_Drop(aura::Window* window) { + AnimateShowWindowCommon(window, GetScaleForWindow(window), gfx::Transform()); +} + +void AnimateHideWindow_Drop(aura::Window* window) { + AnimateHideWindowCommon(window, GetScaleForWindow(window)); +} + +// Show/Hide windows using a vertical Glenimation. +void AnimateShowWindow_Vertical(aura::Window* window) { + gfx::Transform transform; + transform.Translate(0, window->GetProperty( + kWindowVisibilityAnimationVerticalPositionKey)); + AnimateShowWindowCommon(window, transform, gfx::Transform()); +} + +void AnimateHideWindow_Vertical(aura::Window* window) { + gfx::Transform transform; + transform.Translate(0, window->GetProperty( + kWindowVisibilityAnimationVerticalPositionKey)); + AnimateHideWindowCommon(window, transform); +} + +// Show/Hide windows using a fade. +void AnimateShowWindow_Fade(aura::Window* window) { + AnimateShowWindowCommon(window, gfx::Transform(), gfx::Transform()); +} + +void AnimateHideWindow_Fade(aura::Window* window) { + AnimateHideWindowCommon(window, gfx::Transform()); } gfx::Rect GetMinimizeRectForWindow(aura::Window* window) { @@ -133,13 +391,13 @@ void AddLayerAnimationsForMinimize(aura::Window* window, bool show) { new ui::LayerAnimationSequence(transition.release())); // When hiding a window, turn off blending until the animation is 3 / 4 done - // to save bandwidth and reduce jank. + // to save bandwidth and reduce jank if (!show) { window->layer()->GetAnimator()->SchedulePauseForProperties( (duration * 3 ) / 4, ui::LayerAnimationElement::OPACITY, -1); } - // Fade in and out quickly when the window is small to reduce jank. + // Fade in and out quickly when the window is small to reduce jank float opacity = show ? 1.0f : 0.0f; window->layer()->GetAnimator()->ScheduleAnimation( new ui::LayerAnimationSequence( @@ -154,8 +412,8 @@ void AnimateShowWindow_Minimize(aura::Window* window) { // Now that the window has been restored, we need to clear its animation style // to default so that normal animation applies. - views::corewm::SetWindowVisibilityAnimationType( - window, views::corewm::WINDOW_VISIBILITY_ANIMATION_TYPE_DEFAULT); + SetWindowVisibilityAnimationType( + window, WINDOW_VISIBILITY_ANIMATION_TYPE_DEFAULT); } void AnimateHideWindow_Minimize(aura::Window* window) { @@ -166,8 +424,7 @@ void AnimateHideWindow_Minimize(aura::Window* window) { base::TimeDelta duration = base::TimeDelta::FromMilliseconds( kLayerAnimationsForMinimizeDurationMS); settings.SetTransitionDuration(duration); - settings.AddObserver( - views::corewm::CreateHidingWindowAnimationObserver(window)); + settings.AddObserver(new HidingWindowAnimationObserver(window)); window->layer()->SetVisible(false); AddLayerAnimationsForMinimize(window, false); @@ -198,14 +455,13 @@ void AnimateShowHideWindowCommon_BrightnessGrayscale(aura::Window* window, ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator()); settings.SetTransitionDuration(duration); - if (!show) { - settings.AddObserver( - views::corewm::CreateHidingWindowAnimationObserver(window)); - } + if (!show) + settings.AddObserver(new HidingWindowAnimationObserver(window)); window->layer()->GetAnimator()-> ScheduleTogether( - CreateBrightnessGrayscaleAnimationSequence(end_value, duration)); + internal::CreateBrightnessGrayscaleAnimationSequence(end_value, + duration)); if (!show) { window->layer()->SetOpacity(kWindowAnimation_HideOpacity); window->layer()->SetVisible(false); @@ -220,21 +476,141 @@ void AnimateHideWindow_BrightnessGrayscale(aura::Window* window) { AnimateShowHideWindowCommon_BrightnessGrayscale(window, false); } +ui::LayerAnimationElement* CreateGrowShrinkElement( + aura::Window* window, bool grow) { + scoped_ptr<ui::InterpolatedTransform> scale(new ui::InterpolatedScale( + gfx::Point3F(kWindowAnimation_Bounce_Scale, + kWindowAnimation_Bounce_Scale, + 1), + gfx::Point3F(1, 1, 1))); + scoped_ptr<ui::InterpolatedTransform> scale_about_pivot( + new ui::InterpolatedTransformAboutPivot( + gfx::Point(window->bounds().width() * 0.5, + window->bounds().height() * 0.5), + scale.release())); + scale_about_pivot->SetReversed(grow); + scoped_ptr<ui::LayerAnimationElement> transition( + ui::LayerAnimationElement::CreateInterpolatedTransformElement( + scale_about_pivot.release(), + base::TimeDelta::FromMilliseconds( + kWindowAnimation_Bounce_DurationMS * + kWindowAnimation_Bounce_GrowShrinkDurationPercent / 100))); + transition->set_tween_type(grow ? ui::Tween::EASE_OUT : ui::Tween::EASE_IN); + return transition.release(); +} + +void AnimateBounce(aura::Window* window) { + ui::ScopedLayerAnimationSettings scoped_settings( + window->layer()->GetAnimator()); + scoped_settings.SetPreemptionStrategy( + ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); + window->layer()->set_delegate(window); + scoped_ptr<ui::LayerAnimationSequence> sequence( + new ui::LayerAnimationSequence); + sequence->AddElement(CreateGrowShrinkElement(window, true)); + ui::LayerAnimationElement::AnimatableProperties paused_properties; + paused_properties.insert(ui::LayerAnimationElement::BOUNDS); + sequence->AddElement(ui::LayerAnimationElement::CreatePauseElement( + paused_properties, + base::TimeDelta::FromMilliseconds( + kWindowAnimation_Bounce_DurationMS * + (100 - 2 * kWindowAnimation_Bounce_GrowShrinkDurationPercent) / + 100))); + sequence->AddElement(CreateGrowShrinkElement(window, false)); + window->layer()->GetAnimator()->StartAnimation(sequence.release()); +} + +void AddLayerAnimationsForRotate(aura::Window* window, bool show) { + window->layer()->set_delegate(window); + if (show) + window->layer()->SetOpacity(kWindowAnimation_HideOpacity); + + base::TimeDelta duration = base::TimeDelta::FromMilliseconds( + kWindowAnimation_Rotate_DurationMS); + + if (!show) { + new HidingWindowAnimationObserver(window); + window->layer()->GetAnimator()->SchedulePauseForProperties( + duration * (100 - kWindowAnimation_Rotate_OpacityDurationPercent) / 100, + ui::LayerAnimationElement::OPACITY, + -1); + } + scoped_ptr<ui::LayerAnimationElement> opacity( + ui::LayerAnimationElement::CreateOpacityElement( + show ? kWindowAnimation_ShowOpacity : kWindowAnimation_HideOpacity, + duration * kWindowAnimation_Rotate_OpacityDurationPercent / 100)); + opacity->set_tween_type(ui::Tween::EASE_IN_OUT); + window->layer()->GetAnimator()->ScheduleAnimation( + new ui::LayerAnimationSequence(opacity.release())); + + float xcenter = window->bounds().width() * 0.5; + + gfx::Transform transform; + transform.Translate(xcenter, 0); + transform.ApplyPerspectiveDepth(kWindowAnimation_Rotate_PerspectiveDepth); + transform.Translate(-xcenter, 0); + scoped_ptr<ui::InterpolatedTransform> perspective( + new ui::InterpolatedConstantTransform(transform)); + + scoped_ptr<ui::InterpolatedTransform> scale( + new ui::InterpolatedScale(1, kWindowAnimation_Rotate_ScaleFactor)); + scoped_ptr<ui::InterpolatedTransform> scale_about_pivot( + new ui::InterpolatedTransformAboutPivot( + gfx::Point(xcenter, kWindowAnimation_Rotate_TranslateY), + scale.release())); + + scoped_ptr<ui::InterpolatedTransform> translation( + new ui::InterpolatedTranslation(gfx::Point(), gfx::Point( + 0, kWindowAnimation_Rotate_TranslateY))); + + scoped_ptr<ui::InterpolatedTransform> rotation( + new ui::InterpolatedAxisAngleRotation( + gfx::Vector3dF(1, 0, 0), 0, kWindowAnimation_Rotate_DegreesX)); + + scale_about_pivot->SetChild(perspective.release()); + translation->SetChild(scale_about_pivot.release()); + rotation->SetChild(translation.release()); + rotation->SetReversed(show); + + scoped_ptr<ui::LayerAnimationElement> transition( + ui::LayerAnimationElement::CreateInterpolatedTransformElement( + rotation.release(), duration)); + + window->layer()->GetAnimator()->ScheduleAnimation( + new ui::LayerAnimationSequence(transition.release())); +} + +void AnimateShowWindow_Rotate(aura::Window* window) { + AddLayerAnimationsForRotate(window, true); +} +void AnimateHideWindow_Rotate(aura::Window* window) { + AddLayerAnimationsForRotate(window, false); +} bool AnimateShowWindow(aura::Window* window) { - if (!views::corewm::HasWindowVisibilityAnimationTransition( - window, views::corewm::ANIMATE_SHOW)) { + if (!HasWindowVisibilityAnimationTransition(window, ANIMATE_SHOW)) return false; - } - switch (views::corewm::GetWindowVisibilityAnimationType(window)) { + switch (GetWindowVisibilityAnimationType(window)) { + case WINDOW_VISIBILITY_ANIMATION_TYPE_DROP: + AnimateShowWindow_Drop(window); + return true; + case WINDOW_VISIBILITY_ANIMATION_TYPE_VERTICAL: + AnimateShowWindow_Vertical(window); + return true; + case WINDOW_VISIBILITY_ANIMATION_TYPE_FADE: + AnimateShowWindow_Fade(window); + return true; case WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE: AnimateShowWindow_Minimize(window); return true; case WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE: AnimateShowWindow_BrightnessGrayscale(window); return true; + case WINDOW_VISIBILITY_ANIMATION_TYPE_ROTATE: + AnimateShowWindow_Rotate(window); + return true; default: NOTREACHED(); return false; @@ -242,18 +618,28 @@ bool AnimateShowWindow(aura::Window* window) { } bool AnimateHideWindow(aura::Window* window) { - if (!views::corewm::HasWindowVisibilityAnimationTransition( - window, views::corewm::ANIMATE_HIDE)) { + if (!HasWindowVisibilityAnimationTransition(window, ANIMATE_HIDE)) return false; - } - switch (views::corewm::GetWindowVisibilityAnimationType(window)) { + switch (GetWindowVisibilityAnimationType(window)) { + case WINDOW_VISIBILITY_ANIMATION_TYPE_DROP: + AnimateHideWindow_Drop(window); + return true; + case WINDOW_VISIBILITY_ANIMATION_TYPE_VERTICAL: + AnimateHideWindow_Vertical(window); + return true; + case WINDOW_VISIBILITY_ANIMATION_TYPE_FADE: + AnimateHideWindow_Fade(window); + return true; case WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE: AnimateHideWindow_Minimize(window); return true; case WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE: AnimateHideWindow_BrightnessGrayscale(window); return true; + case WINDOW_VISIBILITY_ANIMATION_TYPE_ROTATE: + AnimateHideWindow_Rotate(window); + return true; default: NOTREACHED(); return false; @@ -269,7 +655,7 @@ class CrossFadeObserver : public ui::CompositorObserver, public: // Observes |window| for destruction, but does not take ownership. // Takes ownership of |layer| and its child layers. - CrossFadeObserver(aura::Window* window, ui::Layer* layer) + CrossFadeObserver(Window* window, Layer* layer) : window_(window), layer_(layer) { window_->AddObserver(this); @@ -279,7 +665,7 @@ class CrossFadeObserver : public ui::CompositorObserver, window_->RemoveObserver(this); window_ = NULL; layer_->GetCompositor()->RemoveObserver(this); - views::corewm::DeepDeleteLayers(layer_); + wm::DeepDeleteLayers(layer_); layer_ = NULL; } @@ -299,7 +685,7 @@ class CrossFadeObserver : public ui::CompositorObserver, } // aura::WindowObserver overrides: - virtual void OnWindowDestroying(aura::Window* window) OVERRIDE { + virtual void OnWindowDestroying(Window* window) OVERRIDE { // Triggers OnImplicitAnimationsCompleted() to be called and deletes us. layer_->GetAnimator()->StopAnimating(); } @@ -310,26 +696,31 @@ class CrossFadeObserver : public ui::CompositorObserver, } private: - aura::Window* window_; // not owned - ui::Layer* layer_; // owned + Window* window_; // not owned + Layer* layer_; // owned DISALLOW_COPY_AND_ASSIGN(CrossFadeObserver); }; +} // namespace +} // namespace internal + +namespace { + // Implementation of cross fading. Window is the window being cross faded. It // should be at the target bounds. |old_layer| the previous layer from |window|. // This takes ownership of |old_layer| and deletes when the animation is done. // |pause_duration| is the duration to pause at the current bounds before // animating. Returns the duration of the fade. -base::TimeDelta CrossFadeImpl(aura::Window* window, - ui::Layer* old_layer, - ui::Tween::Type tween_type) { +TimeDelta CrossFadeImpl(aura::Window* window, + ui::Layer* old_layer, + ui::Tween::Type tween_type) { const gfx::Rect old_bounds(old_layer->bounds()); const gfx::Rect new_bounds(window->bounds()); const bool old_on_top = (old_bounds.width() > new_bounds.width()); // Shorten the animation if there's not much visual movement. - const base::TimeDelta duration = GetCrossFadeDuration(old_bounds, new_bounds); + const TimeDelta duration = GetCrossFadeDuration(old_bounds, new_bounds); // Scale up the old layer while translating to new position. { @@ -337,7 +728,7 @@ base::TimeDelta CrossFadeImpl(aura::Window* window, ui::ScopedLayerAnimationSettings settings(old_layer->GetAnimator()); // Animation observer owns the old layer and deletes itself. - settings.AddObserver(new CrossFadeObserver(window, old_layer)); + settings.AddObserver(new internal::CrossFadeObserver(window, old_layer)); settings.SetTransitionDuration(duration); settings.SetTweenType(tween_type); gfx::Transform out_transform; @@ -352,7 +743,7 @@ base::TimeDelta CrossFadeImpl(aura::Window* window, if (old_on_top) { // The old layer is on top, and should fade out. The new layer below will // stay opaque to block the desktop. - old_layer->SetOpacity(kWindowAnimation_HideOpacity); + old_layer->SetOpacity(0.f); } // In tests |old_layer| is deleted here, as animations have zero duration. old_layer = NULL; @@ -372,7 +763,7 @@ base::TimeDelta CrossFadeImpl(aura::Window* window, if (!old_on_top) { // The new layer is on top and should fade in. The old layer below will // stay opaque and block the desktop. - window->layer()->SetOpacity(kWindowAnimation_HideOpacity); + window->layer()->SetOpacity(0.f); } { // Animate the new layer to the identity transform, so the window goes to @@ -383,12 +774,51 @@ base::TimeDelta CrossFadeImpl(aura::Window* window, window->layer()->SetTransform(gfx::Transform()); if (!old_on_top) { // New layer is on top, fade it in. - window->layer()->SetOpacity(kWindowAnimation_ShowOpacity); + window->layer()->SetOpacity(1.f); } } return duration; } +} // namespace + +//////////////////////////////////////////////////////////////////////////////// +// External interface + +void SetWindowVisibilityAnimationType(aura::Window* window, + WindowVisibilityAnimationType type) { + window->SetProperty(internal::kWindowVisibilityAnimationTypeKey, type); +} + +WindowVisibilityAnimationType GetWindowVisibilityAnimationType( + aura::Window* window) { + return window->GetProperty(internal::kWindowVisibilityAnimationTypeKey); +} + +void SetWindowVisibilityAnimationTransition( + aura::Window* window, + WindowVisibilityAnimationTransition transition) { + window->SetProperty(internal::kWindowVisibilityAnimationTransitionKey, + transition); +} + +void SetWindowVisibilityAnimationDuration(aura::Window* window, + const TimeDelta& duration) { + window->SetProperty(internal::kWindowVisibilityAnimationDurationKey, + static_cast<int>(duration.ToInternalValue())); +} + +void SetWindowVisibilityAnimationVerticalPosition(aura::Window* window, + float position) { + window->SetProperty(internal::kWindowVisibilityAnimationVerticalPositionKey, + position); +} + +ui::ImplicitAnimationObserver* CreateHidingWindowAnimationObserver( + aura::Window* window) { + return new internal::HidingWindowAnimationObserver(window); +} + void CrossFadeToBounds(aura::Window* window, const gfx::Rect& new_bounds) { DCHECK(window->TargetVisibility()); const gfx::Rect old_bounds = window->bounds(); @@ -396,7 +826,7 @@ void CrossFadeToBounds(aura::Window* window, const gfx::Rect& new_bounds) { // Create fresh layers for the window and all its children to paint into. // Takes ownership of the old layer and all its children, which will be // cleaned up after the animation completes. - ui::Layer* old_layer = views::corewm::RecreateWindowLayers(window, false); + ui::Layer* old_layer = wm::RecreateWindowLayers(window, false); ui::Layer* new_layer = window->layer(); // Resize the window to the new size, which will force a layout and paint. @@ -423,12 +853,13 @@ void CrossFadeWindowBetweenWorkspaces(aura::Window* new_workspace, else layer_parent->StackBelow(old_layer, new_workspace->layer()); - CrossFadeImpl(window, old_layer, kCrossFadeTweenType); + CrossFadeImpl(window, old_layer, internal::kCrossFadeTweenType); } -base::TimeDelta GetCrossFadeDuration(const gfx::Rect& old_bounds, - const gfx::Rect& new_bounds) { - if (views::corewm::WindowAnimationsDisabled(NULL)) +TimeDelta GetCrossFadeDuration(const gfx::Rect& old_bounds, + const gfx::Rect& new_bounds) { + if (CommandLine::ForCurrentProcess()->HasSwitch( + ash::switches::kAshWindowAnimationsDisabled)) return base::TimeDelta(); int old_area = old_bounds.width() * old_bounds.height(); @@ -436,34 +867,36 @@ base::TimeDelta GetCrossFadeDuration(const gfx::Rect& old_bounds, int max_area = std::max(old_area, new_area); // Avoid divide by zero. if (max_area == 0) - return base::TimeDelta::FromMilliseconds(internal::kWorkspaceSwitchTimeMS); + return TimeDelta::FromMilliseconds(internal::kWorkspaceSwitchTimeMS); int delta_area = std::abs(old_area - new_area); // If the area didn't change, the animation is instantaneous. if (delta_area == 0) - return base::TimeDelta::FromMilliseconds(internal::kWorkspaceSwitchTimeMS); + return TimeDelta::FromMilliseconds(internal::kWorkspaceSwitchTimeMS); float factor = static_cast<float>(delta_area) / static_cast<float>(max_area); - const float kRange = kCrossFadeDurationMaxMs - kCrossFadeDurationMinMs; - return base::TimeDelta::FromMilliseconds( - Round64(kCrossFadeDurationMinMs + (factor * kRange))); + const float kRange = internal::kCrossFadeDurationMaxMs - + internal::kCrossFadeDurationMinMs; + return TimeDelta::FromMilliseconds( + internal::Round64(internal::kCrossFadeDurationMinMs + (factor * kRange))); } +namespace internal { + bool AnimateOnChildWindowVisibilityChanged(aura::Window* window, bool visible) { - if (views::corewm::WindowAnimationsDisabled(window)) + if (window->GetProperty(aura::client::kAnimationsDisabledKey) || + CommandLine::ForCurrentProcess()->HasSwitch( + switches::kAshWindowAnimationsDisabled)) { return false; - - // Attempt to run CoreWm supplied animation types. - if (views::corewm::AnimateOnChildWindowVisibilityChanged(window, visible)) - return true; - - // Otherwise try to run an Ash-specific animation. - if (visible) + } + if (visible) { return AnimateShowWindow(window); - // Don't start hiding the window again if it's already being hidden. - return window->layer()->GetTargetOpacity() != 0.0f && - AnimateHideWindow(window); + } else { + // Don't start hiding the window again if it's already being hidden. + return window->layer()->GetTargetOpacity() != 0.0f && + AnimateHideWindow(window); + } } std::vector<ui::LayerAnimationSequence*> @@ -501,4 +934,16 @@ CreateBrightnessGrayscaleAnimationSequence(float target_value, return animations; } +bool AnimateWindow(aura::Window* window, WindowAnimationType type) { + switch (type) { + case WINDOW_ANIMATION_TYPE_BOUNCE: + AnimateBounce(window); + return true; + default: + NOTREACHED(); + return false; + } +} + +} // namespace internal } // namespace ash diff --git a/ash/wm/window_animations.h b/ash/wm/window_animations.h index 5be60fa..8d08982 100644 --- a/ash/wm/window_animations.h +++ b/ash/wm/window_animations.h @@ -5,30 +5,83 @@ #ifndef ASH_WM_WINDOW_ANIMATIONS_H_ #define ASH_WM_WINDOW_ANIMATIONS_H_ +#include <vector> + #include "ash/ash_export.h" -#include "ui/views/corewm/window_animations.h" namespace aura { class Window; } +namespace base { +class TimeDelta; +} +namespace gfx { +class Rect; +} namespace ui { +class ImplicitAnimationObserver; class Layer; +class LayerAnimationSequence; } -// This is only for animations specific to Ash. For window animations shared -// with desktop Chrome, see ui/views/corewm/window_animations.h. namespace ash { -// An extension of the window animations provided by CoreWm. These should be -// Ash-specific only. +// A variety of canned animations for window transitions. enum WindowVisibilityAnimationType { - // Window scale/rotates down to its launcher icon. - WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE = - views::corewm::WINDOW_VISIBILITY_ANIMATION_MAX, + WINDOW_VISIBILITY_ANIMATION_TYPE_DEFAULT = 0, // Default. Lets the system + // decide based on window + // type. + WINDOW_VISIBILITY_ANIMATION_TYPE_DROP, // Window shrinks in. + WINDOW_VISIBILITY_ANIMATION_TYPE_VERTICAL, // Vertical Glenimation. + WINDOW_VISIBILITY_ANIMATION_TYPE_FADE, // Fades in/out. + WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE, // Window scale/rotates down + // to its launcher icon. // Fade in/out using brightness and grayscale web filters. - WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE + WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE, + WINDOW_VISIBILITY_ANIMATION_TYPE_ROTATE, // Window rotates in. +}; + +// Canned animations that take effect once but don't have a symmetric pair as +// visiblity animations do. +enum WindowAnimationType { + WINDOW_ANIMATION_TYPE_BOUNCE = 0, // Window scales up and down. +}; + +// Type of visibility change transition that a window should animate. +// Default behavior is to animate both show and hide. +enum WindowVisibilityAnimationTransition { + ANIMATE_SHOW = 0x1, + ANIMATE_HIDE = 0x2, + ANIMATE_BOTH = ANIMATE_SHOW | ANIMATE_HIDE, + ANIMATE_NONE = 0x4, }; +ASH_EXPORT void SetWindowVisibilityAnimationType( + aura::Window* window, + WindowVisibilityAnimationType type); + +ASH_EXPORT WindowVisibilityAnimationType GetWindowVisibilityAnimationType( + aura::Window* window); + +ASH_EXPORT void SetWindowVisibilityAnimationTransition( + aura::Window* window, + WindowVisibilityAnimationTransition transition); + +ASH_EXPORT void SetWindowVisibilityAnimationDuration( + aura::Window* window, + const base::TimeDelta& duration); + +ASH_EXPORT void SetWindowVisibilityAnimationVerticalPosition( + aura::Window* window, + float position); + +// Creates an ImplicitAnimationObserver that takes ownership of the layers +// associated with a Window so that the animation can continue after the Window +// has been destroyed. +// The returned object deletes itself when the animations are done. +ASH_EXPORT ui::ImplicitAnimationObserver* CreateHidingWindowAnimationObserver( + aura::Window* window); + // Animate a cross-fade of |window| from its current bounds to |new_bounds|. ASH_EXPORT void CrossFadeToBounds(aura::Window* window, const gfx::Rect& new_bounds); @@ -46,8 +99,12 @@ ASH_EXPORT void CrossFadeWindowBetweenWorkspaces(aura::Window* new_workspace, ASH_EXPORT base::TimeDelta GetCrossFadeDuration(const gfx::Rect& old_bounds, const gfx::Rect& new_bounds); +namespace internal { + +// Returns false if the |window| didn't animate. ASH_EXPORT bool AnimateOnChildWindowVisibilityChanged(aura::Window* window, bool visible); +ASH_EXPORT bool AnimateWindow(aura::Window* window, WindowAnimationType type); // Creates vector of animation sequences that lasts for |duration| and changes // brightness and grayscale to |target_value|. Caller takes ownership of @@ -56,6 +113,7 @@ ASH_EXPORT std::vector<ui::LayerAnimationSequence*> CreateBrightnessGrayscaleAnimationSequence(float target_value, base::TimeDelta duration); +} // namespace internal } // namespace ash diff --git a/ash/wm/window_animations_unittest.cc b/ash/wm/window_animations_unittest.cc index 2f9d95c..34e821b 100644 --- a/ash/wm/window_animations_unittest.cc +++ b/ash/wm/window_animations_unittest.cc @@ -39,19 +39,21 @@ TEST_F(WindowAnimationsTest, HideShowBrightnessGrayscaleAnimation) { EXPECT_TRUE(window->layer()->visible()); // Hiding. - views::corewm::SetWindowVisibilityAnimationType( + SetWindowVisibilityAnimationType( window.get(), WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE); - AnimateOnChildWindowVisibilityChanged(window.get(), false); + ash::internal::AnimateOnChildWindowVisibilityChanged( + window.get(), false); EXPECT_EQ(0.0f, window->layer()->GetTargetOpacity()); EXPECT_FALSE(window->layer()->GetTargetVisibility()); EXPECT_FALSE(window->layer()->visible()); // Showing. - views::corewm::SetWindowVisibilityAnimationType( + SetWindowVisibilityAnimationType( window.get(), WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE); - AnimateOnChildWindowVisibilityChanged(window.get(), true); + ash::internal::AnimateOnChildWindowVisibilityChanged( + window.get(), true); EXPECT_EQ(0.0f, window->layer()->GetTargetBrightness()); EXPECT_EQ(0.0f, window->layer()->GetTargetGrayscale()); EXPECT_TRUE(window->layer()->visible()); diff --git a/ash/wm/window_modality_controller.cc b/ash/wm/window_modality_controller.cc index c16e562..760c5d0 100644 --- a/ash/wm/window_modality_controller.cc +++ b/ash/wm/window_modality_controller.cc @@ -6,6 +6,7 @@ #include <algorithm> +#include "ash/wm/window_animations.h" #include "ash/wm/window_properties.h" #include "ash/wm/window_util.h" #include "ui/aura/client/aura_constants.h" @@ -15,7 +16,6 @@ #include "ui/aura/window.h" #include "ui/base/events/event.h" #include "ui/base/ui_base_types.h" -#include "ui/views/corewm/window_animations.h" namespace ash { @@ -151,8 +151,8 @@ bool WindowModalityController::ProcessLocatedEvent(aura::Window* target, aura::Window* modal_transient_child = wm::GetModalTransient(target); if (modal_transient_child && (event->type() == ui::ET_MOUSE_PRESSED || event->type() == ui::ET_TOUCH_PRESSED)) { - views::corewm::AnimateWindow(modal_transient_child, - views::corewm::WINDOW_ANIMATION_TYPE_BOUNCE); + ash::internal::AnimateWindow(modal_transient_child, + ash::WINDOW_ANIMATION_TYPE_BOUNCE); } return !!modal_transient_child; } diff --git a/ash/wm/window_util.cc b/ash/wm/window_util.cc index c579acc..3adb296 100644 --- a/ash/wm/window_util.cc +++ b/ash/wm/window_util.cc @@ -139,6 +139,32 @@ void CenterWindow(aura::Window* window) { window->SetBounds(center); } +ui::Layer* RecreateWindowLayers(aura::Window* window, bool set_bounds) { + const gfx::Rect bounds = window->bounds(); + ui::Layer* old_layer = window->RecreateLayer(); + DCHECK(old_layer); + for (aura::Window::Windows::const_iterator it = window->children().begin(); + it != window->children().end(); + ++it) { + // Maintain the hierarchy of the detached layers. + old_layer->Add(RecreateWindowLayers(*it, set_bounds)); + } + if (set_bounds) + window->SetBounds(bounds); + return old_layer; +} + +void DeepDeleteLayers(ui::Layer* layer) { + std::vector<ui::Layer*> children = layer->children(); + for (std::vector<ui::Layer*>::const_iterator it = children.begin(); + it != children.end(); + ++it) { + ui::Layer* child = *it; + DeepDeleteLayers(child); + } + delete layer; +} + bool IsWindowPositionManaged(const aura::Window* window) { return window->GetProperty(ash::internal::kWindowPositionManagedKey); } diff --git a/ash/wm/window_util.h b/ash/wm/window_util.h index 80343a4..f1da5b8 100644 --- a/ash/wm/window_util.h +++ b/ash/wm/window_util.h @@ -84,6 +84,21 @@ ASH_EXPORT void ToggleMaximizedWindow(aura::Window* window); // Moves the window to the center of the display. ASH_EXPORT void CenterWindow(aura::Window* window); +// Returns the existing Layer for |window| (and all its descendants) and creates +// a new layer for |window| and all its descendants. This is intended for +// animations that want to animate between the existing visuals and a new window +// state. The caller owns the return value. +// +// As a result of this |window| has freshly created layers, meaning the layers +// are all empty (nothing has been painted to them) and are sized to 0x0. Soon +// after this call you need to reset the bounds of the window. Or, you can pass +// true as the second argument to let the function do that. +ASH_EXPORT ui::Layer* RecreateWindowLayers(aura::Window* window, + bool set_bounds) WARN_UNUSED_RESULT; + +// Deletes |layer| and all its child layers. +ASH_EXPORT void DeepDeleteLayers(ui::Layer* layer); + // Returns true if |window|'s position can automatically be managed. ASH_EXPORT bool IsWindowPositionManaged(const aura::Window* window); diff --git a/ash/wm/workspace/desktop_background_fade_controller.cc b/ash/wm/workspace/desktop_background_fade_controller.cc index 68628b88..444cd43 100644 --- a/ash/wm/workspace/desktop_background_fade_controller.cc +++ b/ash/wm/workspace/desktop_background_fade_controller.cc @@ -39,9 +39,8 @@ DesktopBackgroundFadeController::DesktopBackgroundFadeController( parent->StackChildBelow(fade_window, position_above); parent->StackChildAbove(fade_window, position_above); window_controller_->SetColor(start_color); - views::corewm::SetWindowVisibilityAnimationTransition( - window_controller_->GetWidget()->GetNativeView(), - views::corewm::ANIMATE_NONE); + SetWindowVisibilityAnimationTransition( + window_controller_->GetWidget()->GetNativeView(), ANIMATE_NONE); window_controller_->GetWidget()->Show(); { ui::ScopedLayerAnimationSettings scoped_setter( diff --git a/ash/wm/workspace/multi_window_resize_controller.cc b/ash/wm/workspace/multi_window_resize_controller.cc index 1dea17d..b692b23 100644 --- a/ash/wm/workspace/multi_window_resize_controller.cc +++ b/ash/wm/workspace/multi_window_resize_controller.cc @@ -393,9 +393,9 @@ void MultiWindowResizeController::ShowNow() { ResizeView* view = new ResizeView(this, windows_.direction); resize_widget_->set_focus_on_creation(false); resize_widget_->Init(params); - views::corewm::SetWindowVisibilityAnimationType( + SetWindowVisibilityAnimationType( resize_widget_->GetNativeWindow(), - views::corewm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE); + WINDOW_VISIBILITY_ANIMATION_TYPE_FADE); resize_widget_->GetNativeWindow()->SetName("MultiWindowResizeController"); resize_widget_->SetContentsView(view); show_bounds_in_screen_ = ScreenAsh::ConvertRectToScreen( diff --git a/ash/wm/workspace/workspace.cc b/ash/wm/workspace/workspace.cc index 7f515fc..48f994f 100644 --- a/ash/wm/workspace/workspace.cc +++ b/ash/wm/workspace/workspace.cc @@ -27,7 +27,7 @@ Workspace::Workspace(WorkspaceManager* manager, workspace_layout_manager_(NULL) { window_->SetProperty(internal::kChildWindowVisibilityChangesAnimatedKey, true); - SetWindowVisibilityAnimationTransition(window_, views::corewm::ANIMATE_NONE); + SetWindowVisibilityAnimationTransition(window_, ANIMATE_NONE); window_->set_id(kShellWindowId_WorkspaceContainer); window_->SetName("WorkspaceContainer"); window_->Init(ui::LAYER_NOT_DRAWN); diff --git a/ash/wm/workspace/workspace_layout_manager.cc b/ash/wm/workspace/workspace_layout_manager.cc index e3aff8d..639ad77 100644 --- a/ash/wm/workspace/workspace_layout_manager.cc +++ b/ash/wm/workspace/workspace_layout_manager.cc @@ -23,7 +23,6 @@ #include "ui/aura/window_observer.h" #include "ui/base/events/event.h" #include "ui/base/ui_base_types.h" -#include "ui/views/corewm/window_util.h" using aura::Window; @@ -201,7 +200,7 @@ void WorkspaceLayoutManager::OnWindowPropertyChanged(Window* window, WorkspaceManager::IsMaximizedState(old_state) && new_state != ui::SHOW_STATE_MINIMIZED))) { BuildWindowBoundsMap(window, &bounds_map); - cloned_layer = views::corewm::RecreateWindowLayers(window, false); + cloned_layer = wm::RecreateWindowLayers(window, false); // Constrained windows don't get their bounds reset when we update the // window bounds. Leaving them empty is unexpected, so we reset them now. ResetConstrainedWindowBoundsIfNecessary(bounds_map, window); @@ -252,7 +251,7 @@ void WorkspaceLayoutManager::ShowStateChanged( DCHECK(!cloned_layer); // 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); workspace_manager()->OnWorkspaceWindowShowStateChanged( workspace_, window, last_show_state, NULL); diff --git a/ash/wm/workspace/workspace_window_resizer.cc b/ash/wm/workspace/workspace_window_resizer.cc index b452a12..cd8996a 100644 --- a/ash/wm/workspace/workspace_window_resizer.cc +++ b/ash/wm/workspace/workspace_window_resizer.cc @@ -29,7 +29,6 @@ #include "ui/compositor/layer.h" #include "ui/gfx/screen.h" #include "ui/gfx/transform.h" -#include "ui/views/corewm/window_util.h" namespace ash { @@ -318,7 +317,7 @@ WorkspaceWindowResizer::~WorkspaceWindowResizer() { drag_phantom_window_controller_.reset(); if (layer_) - views::corewm::DeepDeleteLayers(layer_); + wm::DeepDeleteLayers(layer_); if (destroyed_) *destroyed_ = true; @@ -961,7 +960,7 @@ bool WorkspaceWindowResizer::ShouldAllowMouseWarp() const { void WorkspaceWindowResizer::RecreateWindowLayers() { DCHECK(!layer_); - layer_ = views::corewm::RecreateWindowLayers(window(), true); + layer_ = wm::RecreateWindowLayers(window(), true); layer_->set_delegate(window()->layer()->delegate()); // Place the layer at (0, 0) of the PhantomWindowController's window. gfx::Rect layer_bounds = layer_->bounds(); diff --git a/chrome/browser/chromeos/background/ash_user_wallpaper_delegate.cc b/chrome/browser/chromeos/background/ash_user_wallpaper_delegate.cc index bd3aba9..f298132 100644 --- a/chrome/browser/chromeos/background/ash_user_wallpaper_delegate.cc +++ b/chrome/browser/chromeos/background/ash_user_wallpaper_delegate.cc @@ -45,10 +45,10 @@ class UserWallpaperDelegate : public ash::UserWallpaperDelegate { virtual ~UserWallpaperDelegate() { } - virtual int GetAnimationType() OVERRIDE { + virtual ash::WindowVisibilityAnimationType GetAnimationType() OVERRIDE { return ShouldShowInitialAnimation() ? ash::WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE : - static_cast<int>(views::corewm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE); + ash::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE; } virtual bool ShouldShowInitialAnimation() OVERRIDE { diff --git a/chrome/browser/chromeos/input_method/candidate_window_controller_impl.cc b/chrome/browser/chromeos/input_method/candidate_window_controller_impl.cc index f133dae..51c5a72 100644 --- a/chrome/browser/chromeos/input_method/candidate_window_controller_impl.cc +++ b/chrome/browser/chromeos/input_method/candidate_window_controller_impl.cc @@ -60,9 +60,9 @@ void CandidateWindowControllerImpl::CreateView() { #endif frame_->Init(params); #if defined(USE_ASH) - views::corewm::SetWindowVisibilityAnimationType( + ash::SetWindowVisibilityAnimationType( frame_->GetNativeView(), - views::corewm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE); + ash::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE); #endif // USE_ASH // Create the candidate window. @@ -77,9 +77,9 @@ void CandidateWindowControllerImpl::CreateView() { infolist_window_.reset(new DelayableWidget); infolist_window_->Init(params); #if defined(USE_ASH) - views::corewm::SetWindowVisibilityAnimationType( + ash::SetWindowVisibilityAnimationType( infolist_window_->GetNativeView(), - views::corewm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE); + ash::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE); #endif // USE_ASH InfolistWindowView* infolist_view = new InfolistWindowView; diff --git a/chrome/browser/chromeos/login/lock_window_aura.cc b/chrome/browser/chromeos/login/lock_window_aura.cc index 5ceadd1..65be222 100644 --- a/chrome/browser/chromeos/login/lock_window_aura.cc +++ b/chrome/browser/chromeos/login/lock_window_aura.cc @@ -52,8 +52,8 @@ void LockWindowAura::Init() { ash::Shell::GetPrimaryRootWindow(), ash::internal::kShellWindowId_LockScreenContainer); views::Widget::Init(params); - views::corewm::SetWindowVisibilityAnimationTransition( - GetNativeView(), views::corewm::ANIMATE_NONE); + ash::SetWindowVisibilityAnimationTransition(GetNativeView(), + ash::ANIMATE_NONE); } } // namespace chromeos diff --git a/chrome/browser/chromeos/login/webui_login_display_host.cc b/chrome/browser/chromeos/login/webui_login_display_host.cc index ecc3cd0..2b63525 100644 --- a/chrome/browser/chromeos/login/webui_login_display_host.cc +++ b/chrome/browser/chromeos/login/webui_login_display_host.cc @@ -294,12 +294,12 @@ void WebUILoginDisplayHost::LoadURL(const GURL& url) { login_view_->Init(login_window_); - views::corewm::SetWindowVisibilityAnimationDuration( + ash::SetWindowVisibilityAnimationDuration( login_window_->GetNativeView(), base::TimeDelta::FromMilliseconds(kLoginFadeoutTransitionDurationMs)); - views::corewm::SetWindowVisibilityAnimationTransition( + ash::SetWindowVisibilityAnimationTransition( login_window_->GetNativeView(), - views::corewm::ANIMATE_HIDE); + ash::ANIMATE_HIDE); login_window_->SetContentsView(login_view_); login_view_->UpdateWindowType(); diff --git a/chrome/browser/ui/views/constrained_window_views.cc b/chrome/browser/ui/views/constrained_window_views.cc index efc0af3..97f516c 100644 --- a/chrome/browser/ui/views/constrained_window_views.cc +++ b/chrome/browser/ui/views/constrained_window_views.cc @@ -56,16 +56,13 @@ #include "ui/views/widget/native_widget_win.h" #endif -#if defined(USE_AURA) -#include "ui/views/corewm/window_animations.h" -#endif - #if defined(USE_ASH) #include "ash/ash_constants.h" #include "ash/ash_switches.h" #include "ash/shell.h" #include "ash/wm/custom_frame_view_ash.h" #include "ash/wm/visibility_controller.h" +#include "ash/wm/window_animations.h" #include "ash/wm/window_modality_controller.h" #include "ui/aura/window.h" #endif @@ -641,11 +638,11 @@ ConstrainedWindowViews::~ConstrainedWindowViews() { } void ConstrainedWindowViews::ShowConstrainedWindow() { -#if defined(USE_AURA) +#if defined(USE_ASH) if (enable_chrome_style_) { - views::corewm::SetWindowVisibilityAnimationType( + ash::SetWindowVisibilityAnimationType( GetNativeWindow(), - views::corewm::WINDOW_VISIBILITY_ANIMATION_TYPE_ROTATE); + ash::WINDOW_VISIBILITY_ANIMATION_TYPE_ROTATE); } #endif Show(); diff --git a/chrome/browser/ui/views/extensions/extension_popup.cc b/chrome/browser/ui/views/extensions/extension_popup.cc index 12461f7..9b76789 100644 --- a/chrome/browser/ui/views/extensions/extension_popup.cc +++ b/chrome/browser/ui/views/extensions/extension_popup.cc @@ -24,7 +24,10 @@ #if defined(USE_AURA) #include "ui/aura/window.h" -#include "ui/views/corewm/window_animations.h" +#endif + +#if defined(USE_ASH) +#include "ash/wm/window_animations.h" #endif using content::RenderViewHost; @@ -184,12 +187,12 @@ ExtensionPopup* ExtensionPopup::ShowPopup( arrow_location, show_action); views::BubbleDelegateView::CreateBubble(popup); -#if defined(USE_AURA) +#if defined(USE_ASH) gfx::NativeView native_view = popup->GetWidget()->GetNativeView(); - views::corewm::SetWindowVisibilityAnimationType( + ash::SetWindowVisibilityAnimationType( native_view, - views::corewm::WINDOW_VISIBILITY_ANIMATION_TYPE_VERTICAL); - views::corewm::SetWindowVisibilityAnimationVerticalPosition( + ash::WINDOW_VISIBILITY_ANIMATION_TYPE_VERTICAL); + ash::SetWindowVisibilityAnimationVerticalPosition( native_view, -3.0f); #endif diff --git a/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc b/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc index d80c1ab..5cb8851 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc @@ -16,10 +16,6 @@ #include "ui/gfx/path.h" #include "ui/views/widget/widget.h" -#if defined(USE_AURA) -#include "ui/views/corewm/window_animations.h" -#endif - #if defined(OS_WIN) #include <dwmapi.h> @@ -28,6 +24,9 @@ #include "ui/base/win/shell.h" #endif #endif +#if defined(USE_ASH) +#include "ash/wm/window_animations.h" +#endif namespace { @@ -218,14 +217,17 @@ void OmniboxPopupContentsView::UpdatePopupAppearance() { params.bounds = GetPopupBounds(); params.context = location_bar_->GetWidget()->GetNativeView(); popup_->Init(params); -#if defined(USE_AURA) - views::corewm::SetWindowVisibilityAnimationType( +#if defined(USE_ASH) + ash::SetWindowVisibilityAnimationType( popup_->GetNativeView(), - views::corewm::WINDOW_VISIBILITY_ANIMATION_TYPE_VERTICAL); + ash::WINDOW_VISIBILITY_ANIMATION_TYPE_VERTICAL); + // Meanie-pants designers won't let us animate the appearance in + // production, but we will do it anyway for desktop-aura for the time being + // as it lets usverify quickly that hotness is enabled. #if defined(OS_CHROMEOS) // No animation for autocomplete popup appearance. - views::corewm::SetWindowVisibilityAnimationTransition( - popup_->GetNativeView(), views::corewm::ANIMATE_HIDE); + ash::SetWindowVisibilityAnimationTransition( + popup_->GetNativeView(), ash::ANIMATE_HIDE); #endif #endif popup_->SetContentsView(this); diff --git a/ui/views/corewm/corewm_switches.cc b/ui/views/corewm/corewm_switches.cc deleted file mode 100644 index 8f79afe..0000000 --- a/ui/views/corewm/corewm_switches.cc +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ui/views/corewm/corewm_switches.h" - -namespace views { -namespace corewm { -namespace switches { - -// If present animations are disabled. -const char kWindowAnimationsDisabled[] = - "views-corewm-window-animations-disabled"; - -} // namespace switches -} // namespace corewm -} // namespace views diff --git a/ui/views/corewm/corewm_switches.h b/ui/views/corewm/corewm_switches.h deleted file mode 100644 index 472e7b0..0000000 --- a/ui/views/corewm/corewm_switches.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef UI_VIEWS_COREWM_COREWM_SWITCHES_H_ -#define UI_VIEWS_COREWM_COREWM_SWITCHES_H_ - -#include "build/build_config.h" -#include "ui/views/views_export.h" - -namespace views { -namespace corewm { -namespace switches { - -// Note: If you add a switch, consider if it needs to be copied to a subsequent -// command line if the process executes a new copy of itself. (For example, -// see chromeos::LoginUtil::GetOffTheRecordCommandLine().) - -// Please keep alphabetized. -VIEWS_EXPORT extern const char kWindowAnimationsDisabled[]; - -} // namespace switches -} // namespace corewm -} // namespace views - -#endif // UI_VIEWS_COREWM_COREWM_SWITCHES_H_ diff --git a/ui/views/corewm/window_animations.cc b/ui/views/corewm/window_animations.cc deleted file mode 100644 index e1f0810..0000000 --- a/ui/views/corewm/window_animations.cc +++ /dev/null @@ -1,494 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ui/views/corewm/window_animations.h" - -#include <math.h> - -#include <algorithm> -#include <vector> - -#include "base/command_line.h" -#include "base/compiler_specific.h" -#include "base/logging.h" -#include "base/message_loop.h" -#include "base/stl_util.h" -#include "base/time.h" -#include "ui/aura/client/aura_constants.h" -#include "ui/aura/window.h" -#include "ui/aura/window_observer.h" -#include "ui/aura/window_property.h" -#include "ui/compositor/compositor_observer.h" -#include "ui/compositor/layer.h" -#include "ui/compositor/layer_animation_observer.h" -#include "ui/compositor/layer_animation_sequence.h" -#include "ui/compositor/layer_animator.h" -#include "ui/compositor/scoped_layer_animation_settings.h" -#include "ui/gfx/interpolated_transform.h" -#include "ui/gfx/screen.h" -#include "ui/gfx/vector3d_f.h" -#include "ui/views/corewm/corewm_switches.h" -#include "ui/views/corewm/window_util.h" -#include "ui/views/view.h" -#include "ui/views/widget/widget.h" - -DECLARE_WINDOW_PROPERTY_TYPE(int) -DECLARE_WINDOW_PROPERTY_TYPE(views::corewm::WindowVisibilityAnimationType) -DECLARE_WINDOW_PROPERTY_TYPE(views::corewm::WindowVisibilityAnimationTransition) -DECLARE_WINDOW_PROPERTY_TYPE(float) -DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(VIEWS_EXPORT, bool) - -using aura::Window; -using base::TimeDelta; -using ui::Layer; - -namespace views { -namespace corewm { -namespace { -const float kWindowAnimation_Vertical_TranslateY = 15.f; -} // namespace - -DEFINE_WINDOW_PROPERTY_KEY(int, - kWindowVisibilityAnimationTypeKey, - WINDOW_VISIBILITY_ANIMATION_TYPE_DEFAULT); -DEFINE_WINDOW_PROPERTY_KEY(int, kWindowVisibilityAnimationDurationKey, 0); -DEFINE_WINDOW_PROPERTY_KEY(WindowVisibilityAnimationTransition, - kWindowVisibilityAnimationTransitionKey, - ANIMATE_BOTH); -DEFINE_WINDOW_PROPERTY_KEY(float, - kWindowVisibilityAnimationVerticalPositionKey, - kWindowAnimation_Vertical_TranslateY); - -namespace { - -const int kDefaultAnimationDurationForMenuMS = 150; - -const float kWindowAnimation_HideOpacity = 0.f; -const float kWindowAnimation_ShowOpacity = 1.f; -const float kWindowAnimation_TranslateFactor = 0.025f; -const float kWindowAnimation_ScaleFactor = .95f; - -const int kWindowAnimation_Rotate_DurationMS = 180; -const int kWindowAnimation_Rotate_OpacityDurationPercent = 90; -const float kWindowAnimation_Rotate_TranslateY = -20.f; -const float kWindowAnimation_Rotate_PerspectiveDepth = 500.f; -const float kWindowAnimation_Rotate_DegreesX = 5.f; -const float kWindowAnimation_Rotate_ScaleFactor = .99f; - -const float kWindowAnimation_Bounce_Scale = 1.02f; -const int kWindowAnimation_Bounce_DurationMS = 180; -const int kWindowAnimation_Bounce_GrowShrinkDurationPercent = 40; - -base::TimeDelta GetWindowVisibilityAnimationDuration(aura::Window* window) { - int duration = - window->GetProperty(kWindowVisibilityAnimationDurationKey); - if (duration == 0 && window->type() == aura::client::WINDOW_TYPE_MENU) { - return base::TimeDelta::FromMilliseconds( - kDefaultAnimationDurationForMenuMS); - } - return TimeDelta::FromInternalValue(duration); -} - -// Gets/sets the WindowVisibilityAnimationType associated with a window. -// TODO(beng): redundant/fold into method on public api? -int GetWindowVisibilityAnimationType(aura::Window* window) { - int type = window->GetProperty(kWindowVisibilityAnimationTypeKey); - if (type == WINDOW_VISIBILITY_ANIMATION_TYPE_DEFAULT) { - return (window->type() == aura::client::WINDOW_TYPE_MENU || - window->type() == aura::client::WINDOW_TYPE_TOOLTIP) ? - WINDOW_VISIBILITY_ANIMATION_TYPE_FADE : - WINDOW_VISIBILITY_ANIMATION_TYPE_DROP; - } - return type; -} - -// Observes a hide animation. -// A window can be hidden for a variety of reasons. Sometimes, Hide() will be -// called and life is simple. Sometimes, the window is actually bound to a -// views::Widget and that Widget is closed, and life is a little more -// complicated. When a Widget is closed the aura::Window* is actually not -// destroyed immediately - it is actually just immediately hidden and then -// destroyed when the stack unwinds. To handle this case, we start the hide -// animation immediately when the window is hidden, then when the window is -// subsequently destroyed this object acquires ownership of the window's layer, -// so that it can continue animating it until the animation completes. -// Regardless of whether or not the window is destroyed, this object deletes -// itself when the animation completes. -class HidingWindowAnimationObserver : public ui::ImplicitAnimationObserver, - public aura::WindowObserver { - public: - explicit HidingWindowAnimationObserver(aura::Window* window) - : window_(window) { - window_->AddObserver(this); - } - virtual ~HidingWindowAnimationObserver() { - STLDeleteElements(&layers_); - } - - private: - // Overridden from ui::ImplicitAnimationObserver: - virtual void OnImplicitAnimationsCompleted() OVERRIDE { - // Window may have been destroyed by this point. - if (window_) - window_->RemoveObserver(this); - delete this; - } - - // Overridden from aura::WindowObserver: - virtual void OnWindowDestroying(aura::Window* window) OVERRIDE { - DCHECK_EQ(window, window_); - DCHECK(layers_.empty()); - AcquireAllLayers(window_); - - // If the Widget has views with layers, then it is necessary to take - // ownership of those layers too. - views::Widget* widget = views::Widget::GetWidgetForNativeWindow(window_); - const views::Widget* const_widget = widget; - if (widget && const_widget->GetRootView() && widget->GetContentsView()) - AcquireAllViewLayers(widget->GetContentsView()); - window_->RemoveObserver(this); - window_ = NULL; - } - - void AcquireAllLayers(aura::Window* window) { - ui::Layer* layer = window->AcquireLayer(); - DCHECK(layer); - layers_.push_back(layer); - for (aura::Window::Windows::const_iterator it = window->children().begin(); - it != window->children().end(); - ++it) - AcquireAllLayers(*it); - } - - void AcquireAllViewLayers(views::View* view) { - for (int i = 0; i < view->child_count(); ++i) - AcquireAllViewLayers(view->child_at(i)); - if (view->layer()) { - ui::Layer* layer = view->RecreateLayer(); - if (layer) { - layer->SuppressPaint(); - layers_.push_back(layer); - } - } - } - - aura::Window* window_; - std::vector<ui::Layer*> layers_; - - DISALLOW_COPY_AND_ASSIGN(HidingWindowAnimationObserver); -}; - -// Shows a window using an animation, animating its opacity from 0.f to 1.f, -// its visibility to true, and its transform from |start_transform| to -// |end_transform|. -void AnimateShowWindowCommon(aura::Window* window, - const gfx::Transform& start_transform, - const gfx::Transform& end_transform) { - window->layer()->set_delegate(window); - window->layer()->SetOpacity(kWindowAnimation_HideOpacity); - window->layer()->SetTransform(start_transform); - window->layer()->SetVisible(true); - - { - // Property sets within this scope will be implicitly animated. - ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator()); - base::TimeDelta duration = GetWindowVisibilityAnimationDuration(window); - if (duration.ToInternalValue() > 0) - settings.SetTransitionDuration(duration); - - window->layer()->SetTransform(end_transform); - window->layer()->SetOpacity(kWindowAnimation_ShowOpacity); - } -} - -// Hides a window using an animation, animating its opacity from 1.f to 0.f, -// its visibility to false, and its transform to |end_transform|. -void AnimateHideWindowCommon(aura::Window* window, - const gfx::Transform& end_transform) { - window->layer()->set_delegate(NULL); - - // Property sets within this scope will be implicitly animated. - ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator()); - settings.AddObserver(new HidingWindowAnimationObserver(window)); - - base::TimeDelta duration = GetWindowVisibilityAnimationDuration(window); - if (duration.ToInternalValue() > 0) - settings.SetTransitionDuration(duration); - - window->layer()->SetOpacity(kWindowAnimation_HideOpacity); - window->layer()->SetTransform(end_transform); - window->layer()->SetVisible(false); -} - -static gfx::Transform GetScaleForWindow(aura::Window* window) { - gfx::Rect bounds = window->bounds(); - gfx::Transform scale = gfx::GetScaleTransform( - gfx::Point(kWindowAnimation_TranslateFactor * bounds.width(), - kWindowAnimation_TranslateFactor * bounds.height()), - kWindowAnimation_ScaleFactor); - return scale; -} - -// Show/Hide windows using a shrink animation. -void AnimateShowWindow_Drop(aura::Window* window) { - AnimateShowWindowCommon(window, GetScaleForWindow(window), gfx::Transform()); -} - -void AnimateHideWindow_Drop(aura::Window* window) { - AnimateHideWindowCommon(window, GetScaleForWindow(window)); -} - -// Show/Hide windows using a vertical Glenimation. -void AnimateShowWindow_Vertical(aura::Window* window) { - gfx::Transform transform; - transform.Translate(0, window->GetProperty( - kWindowVisibilityAnimationVerticalPositionKey)); - AnimateShowWindowCommon(window, transform, gfx::Transform()); -} - -void AnimateHideWindow_Vertical(aura::Window* window) { - gfx::Transform transform; - transform.Translate(0, window->GetProperty( - kWindowVisibilityAnimationVerticalPositionKey)); - AnimateHideWindowCommon(window, transform); -} - -// Show/Hide windows using a fade. -void AnimateShowWindow_Fade(aura::Window* window) { - AnimateShowWindowCommon(window, gfx::Transform(), gfx::Transform()); -} - -void AnimateHideWindow_Fade(aura::Window* window) { - AnimateHideWindowCommon(window, gfx::Transform()); -} - -ui::LayerAnimationElement* CreateGrowShrinkElement( - aura::Window* window, bool grow) { - scoped_ptr<ui::InterpolatedTransform> scale(new ui::InterpolatedScale( - gfx::Point3F(kWindowAnimation_Bounce_Scale, - kWindowAnimation_Bounce_Scale, - 1), - gfx::Point3F(1, 1, 1))); - scoped_ptr<ui::InterpolatedTransform> scale_about_pivot( - new ui::InterpolatedTransformAboutPivot( - gfx::Point(window->bounds().width() * 0.5, - window->bounds().height() * 0.5), - scale.release())); - scale_about_pivot->SetReversed(grow); - scoped_ptr<ui::LayerAnimationElement> transition( - ui::LayerAnimationElement::CreateInterpolatedTransformElement( - scale_about_pivot.release(), - base::TimeDelta::FromMilliseconds( - kWindowAnimation_Bounce_DurationMS * - kWindowAnimation_Bounce_GrowShrinkDurationPercent / 100))); - transition->set_tween_type(grow ? ui::Tween::EASE_OUT : ui::Tween::EASE_IN); - return transition.release(); -} - -void AnimateBounce(aura::Window* window) { - ui::ScopedLayerAnimationSettings scoped_settings( - window->layer()->GetAnimator()); - scoped_settings.SetPreemptionStrategy( - ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); - window->layer()->set_delegate(window); - scoped_ptr<ui::LayerAnimationSequence> sequence( - new ui::LayerAnimationSequence); - sequence->AddElement(CreateGrowShrinkElement(window, true)); - ui::LayerAnimationElement::AnimatableProperties paused_properties; - paused_properties.insert(ui::LayerAnimationElement::BOUNDS); - sequence->AddElement(ui::LayerAnimationElement::CreatePauseElement( - paused_properties, - base::TimeDelta::FromMilliseconds( - kWindowAnimation_Bounce_DurationMS * - (100 - 2 * kWindowAnimation_Bounce_GrowShrinkDurationPercent) / - 100))); - sequence->AddElement(CreateGrowShrinkElement(window, false)); - window->layer()->GetAnimator()->StartAnimation(sequence.release()); -} - -void AddLayerAnimationsForRotate(aura::Window* window, bool show) { - window->layer()->set_delegate(window); - if (show) - window->layer()->SetOpacity(kWindowAnimation_HideOpacity); - - base::TimeDelta duration = base::TimeDelta::FromMilliseconds( - kWindowAnimation_Rotate_DurationMS); - - if (!show) { - new HidingWindowAnimationObserver(window); - window->layer()->GetAnimator()->SchedulePauseForProperties( - duration * (100 - kWindowAnimation_Rotate_OpacityDurationPercent) / 100, - ui::LayerAnimationElement::OPACITY, - -1); - } - scoped_ptr<ui::LayerAnimationElement> opacity( - ui::LayerAnimationElement::CreateOpacityElement( - show ? kWindowAnimation_ShowOpacity : kWindowAnimation_HideOpacity, - duration * kWindowAnimation_Rotate_OpacityDurationPercent / 100)); - opacity->set_tween_type(ui::Tween::EASE_IN_OUT); - window->layer()->GetAnimator()->ScheduleAnimation( - new ui::LayerAnimationSequence(opacity.release())); - - float xcenter = window->bounds().width() * 0.5; - - gfx::Transform transform; - transform.Translate(xcenter, 0); - transform.ApplyPerspectiveDepth(kWindowAnimation_Rotate_PerspectiveDepth); - transform.Translate(-xcenter, 0); - scoped_ptr<ui::InterpolatedTransform> perspective( - new ui::InterpolatedConstantTransform(transform)); - - scoped_ptr<ui::InterpolatedTransform> scale( - new ui::InterpolatedScale(1, kWindowAnimation_Rotate_ScaleFactor)); - scoped_ptr<ui::InterpolatedTransform> scale_about_pivot( - new ui::InterpolatedTransformAboutPivot( - gfx::Point(xcenter, kWindowAnimation_Rotate_TranslateY), - scale.release())); - - scoped_ptr<ui::InterpolatedTransform> translation( - new ui::InterpolatedTranslation(gfx::Point(), gfx::Point( - 0, kWindowAnimation_Rotate_TranslateY))); - - scoped_ptr<ui::InterpolatedTransform> rotation( - new ui::InterpolatedAxisAngleRotation( - gfx::Vector3dF(1, 0, 0), 0, kWindowAnimation_Rotate_DegreesX)); - - scale_about_pivot->SetChild(perspective.release()); - translation->SetChild(scale_about_pivot.release()); - rotation->SetChild(translation.release()); - rotation->SetReversed(show); - - scoped_ptr<ui::LayerAnimationElement> transition( - ui::LayerAnimationElement::CreateInterpolatedTransformElement( - rotation.release(), duration)); - - window->layer()->GetAnimator()->ScheduleAnimation( - new ui::LayerAnimationSequence(transition.release())); -} - -void AnimateShowWindow_Rotate(aura::Window* window) { - AddLayerAnimationsForRotate(window, true); -} - -void AnimateHideWindow_Rotate(aura::Window* window) { - AddLayerAnimationsForRotate(window, false); -} - -bool AnimateShowWindow(aura::Window* window) { - if (!HasWindowVisibilityAnimationTransition(window, ANIMATE_SHOW)) - return false; - - switch (GetWindowVisibilityAnimationType(window)) { - case WINDOW_VISIBILITY_ANIMATION_TYPE_DROP: - AnimateShowWindow_Drop(window); - return true; - case WINDOW_VISIBILITY_ANIMATION_TYPE_VERTICAL: - AnimateShowWindow_Vertical(window); - return true; - case WINDOW_VISIBILITY_ANIMATION_TYPE_FADE: - AnimateShowWindow_Fade(window); - return true; - case WINDOW_VISIBILITY_ANIMATION_TYPE_ROTATE: - AnimateShowWindow_Rotate(window); - return true; - default: - return false; - } -} - -bool AnimateHideWindow(aura::Window* window) { - if (!HasWindowVisibilityAnimationTransition(window, ANIMATE_HIDE)) - return false; - - switch (GetWindowVisibilityAnimationType(window)) { - case WINDOW_VISIBILITY_ANIMATION_TYPE_DROP: - AnimateHideWindow_Drop(window); - return true; - case WINDOW_VISIBILITY_ANIMATION_TYPE_VERTICAL: - AnimateHideWindow_Vertical(window); - return true; - case WINDOW_VISIBILITY_ANIMATION_TYPE_FADE: - AnimateHideWindow_Fade(window); - return true; - case WINDOW_VISIBILITY_ANIMATION_TYPE_ROTATE: - AnimateHideWindow_Rotate(window); - return true; - default: - return false; - } -} - -} // namespace - -//////////////////////////////////////////////////////////////////////////////// -// External interface - -void SetWindowVisibilityAnimationType(aura::Window* window, int type) { - window->SetProperty(kWindowVisibilityAnimationTypeKey, type); -} - -int GetWindowVisibilityAnimationType(aura::Window* window) { - return window->GetProperty(kWindowVisibilityAnimationTypeKey); -} - -void SetWindowVisibilityAnimationTransition( - aura::Window* window, - WindowVisibilityAnimationTransition transition) { - window->SetProperty(kWindowVisibilityAnimationTransitionKey, transition); -} - -bool HasWindowVisibilityAnimationTransition( - aura::Window* window, - WindowVisibilityAnimationTransition transition) { - WindowVisibilityAnimationTransition prop = window->GetProperty( - kWindowVisibilityAnimationTransitionKey); - return (prop & transition) != 0; -} - -void SetWindowVisibilityAnimationDuration(aura::Window* window, - const TimeDelta& duration) { - window->SetProperty(kWindowVisibilityAnimationDurationKey, - static_cast<int>(duration.ToInternalValue())); -} - -void SetWindowVisibilityAnimationVerticalPosition(aura::Window* window, - float position) { - window->SetProperty(kWindowVisibilityAnimationVerticalPositionKey, position); -} - -ui::ImplicitAnimationObserver* CreateHidingWindowAnimationObserver( - aura::Window* window) { - return new HidingWindowAnimationObserver(window); -} - -bool AnimateOnChildWindowVisibilityChanged(aura::Window* window, bool visible) { - if (WindowAnimationsDisabled(window)) - return false; - if (visible) - return AnimateShowWindow(window); - // Don't start hiding the window again if it's already being hidden. - return window->layer()->GetTargetOpacity() != 0.0f && - AnimateHideWindow(window); -} - -bool AnimateWindow(aura::Window* window, WindowAnimationType type) { - switch (type) { - case WINDOW_ANIMATION_TYPE_BOUNCE: - AnimateBounce(window); - return true; - default: - NOTREACHED(); - return false; - } -} - -bool WindowAnimationsDisabled(aura::Window* window) { - return (window && - window->GetProperty(aura::client::kAnimationsDisabledKey)) || - CommandLine::ForCurrentProcess()->HasSwitch( - switches::kWindowAnimationsDisabled); -} - -} // namespace corewm -} // namespace views diff --git a/ui/views/corewm/window_animations.h b/ui/views/corewm/window_animations.h deleted file mode 100644 index 996c215..0000000 --- a/ui/views/corewm/window_animations.h +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef UI_VIEWS_COREWM_WINDOW_ANIMATIONS_H_ -#define UI_VIEWS_COREWM_WINDOW_ANIMATIONS_H_ - -#include <vector> - -#include "ui/views/views_export.h" - -namespace aura { -class Window; -} -namespace base { -class TimeDelta; -} -namespace gfx { -class Rect; -} -namespace ui { -class ImplicitAnimationObserver; -class Layer; -class LayerAnimationSequence; -} - -namespace views { -namespace corewm { - -// A variety of canned animations for window transitions. -enum WindowVisibilityAnimationType { - WINDOW_VISIBILITY_ANIMATION_TYPE_DEFAULT = 0, // Default. Lets the system - // decide based on window - // type. - WINDOW_VISIBILITY_ANIMATION_TYPE_DROP, // Window shrinks in. - WINDOW_VISIBILITY_ANIMATION_TYPE_VERTICAL, // Vertical Glenimation. - WINDOW_VISIBILITY_ANIMATION_TYPE_FADE, // Fades in/out. - WINDOW_VISIBILITY_ANIMATION_TYPE_ROTATE, // Window rotates in. - - // Downstream library animations start above this point. - WINDOW_VISIBILITY_ANIMATION_MAX -}; - -// Canned animations that take effect once but don't have a symmetric pair as -// visibility animations do. -enum WindowAnimationType { - WINDOW_ANIMATION_TYPE_BOUNCE = 0, // Window scales up and down. -}; - -// Type of visibility change transition that a window should animate. -// Default behavior is to animate both show and hide. -enum WindowVisibilityAnimationTransition { - ANIMATE_SHOW = 0x1, - ANIMATE_HIDE = 0x2, - ANIMATE_BOTH = ANIMATE_SHOW | ANIMATE_HIDE, - ANIMATE_NONE = 0x4, -}; - -// These two methods use int for type rather than WindowVisibilityAnimationType -// since downstream libraries can extend the set of animations. -VIEWS_EXPORT void SetWindowVisibilityAnimationType(aura::Window* window, - int type); -VIEWS_EXPORT int GetWindowVisibilityAnimationType(aura::Window* window); - -VIEWS_EXPORT void SetWindowVisibilityAnimationTransition( - aura::Window* window, - WindowVisibilityAnimationTransition transition); - -VIEWS_EXPORT bool HasWindowVisibilityAnimationTransition( - aura::Window* window, - WindowVisibilityAnimationTransition transition); - -VIEWS_EXPORT void SetWindowVisibilityAnimationDuration( - aura::Window* window, - const base::TimeDelta& duration); - -VIEWS_EXPORT void SetWindowVisibilityAnimationVerticalPosition( - aura::Window* window, - float position); - -// Creates an ImplicitAnimationObserver that takes ownership of the layers -// associated with a Window so that the animation can continue after the Window -// has been destroyed. -// The returned object deletes itself when the animations are done. -VIEWS_EXPORT ui::ImplicitAnimationObserver* CreateHidingWindowAnimationObserver( - aura::Window* window); - -// Returns false if the |window| didn't animate. -VIEWS_EXPORT bool AnimateOnChildWindowVisibilityChanged(aura::Window* window, - bool visible); -VIEWS_EXPORT bool AnimateWindow(aura::Window* window, WindowAnimationType type); - -// Returns true if window animations are disabled for |window|. Window -// animations are enabled by default. If |window| is NULL, this just checks -// if the global flag disabling window animations is present. -VIEWS_EXPORT bool WindowAnimationsDisabled(aura::Window* window); - -} // namespace corewm -} // namespace views - -#endif // UI_VIEWS_COREWM_WINDOW_ANIMATIONS_H_ diff --git a/ui/views/corewm/window_animations_unittest.cc b/ui/views/corewm/window_animations_unittest.cc deleted file mode 100644 index 66704f0..0000000 --- a/ui/views/corewm/window_animations_unittest.cc +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ui/views/corewm/window_animations.h" - -#include "base/time.h" -#include "ui/aura/test/aura_test_base.h" -#include "ui/aura/test/test_windows.h" -#include "ui/aura/window.h" -#include "ui/base/animation/animation_container_element.h" -#include "ui/compositor/layer.h" -#include "ui/compositor/layer_animator.h" - -using aura::Window; -using ui::Layer; - -namespace views { -namespace corewm { - -class WindowAnimationsTest : public aura::test::AuraTestBase { - public: - WindowAnimationsTest() {} - - virtual void TearDown() OVERRIDE { - ui::LayerAnimator::set_disable_animations_for_test(true); - AuraTestBase::TearDown(); - } - - private: - DISALLOW_COPY_AND_ASSIGN(WindowAnimationsTest); -}; - -TEST_F(WindowAnimationsTest, HideShowBrightnessGrayscaleAnimation) { - scoped_ptr<aura::Window> window( - aura::test::CreateTestWindowWithId(0, NULL)); - window->Show(); - EXPECT_TRUE(window->layer()->visible()); - - // Hiding. - SetWindowVisibilityAnimationType( - window.get(), - WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE); - AnimateOnChildWindowVisibilityChanged(window.get(), false); - EXPECT_EQ(0.0f, window->layer()->GetTargetOpacity()); - EXPECT_FALSE(window->layer()->GetTargetVisibility()); - EXPECT_FALSE(window->layer()->visible()); - - // Showing. - SetWindowVisibilityAnimationType( - window.get(), - WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE); - AnimateOnChildWindowVisibilityChanged(window.get(), true); - EXPECT_EQ(0.0f, window->layer()->GetTargetBrightness()); - EXPECT_EQ(0.0f, window->layer()->GetTargetGrayscale()); - EXPECT_TRUE(window->layer()->visible()); - - // Stays shown. - ui::AnimationContainerElement* element = - static_cast<ui::AnimationContainerElement*>( - window->layer()->GetAnimator()); - element->Step(base::TimeTicks::Now() + - base::TimeDelta::FromSeconds(5)); - EXPECT_EQ(0.0f, window->layer()->GetTargetBrightness()); - EXPECT_EQ(0.0f, window->layer()->GetTargetGrayscale()); - EXPECT_TRUE(window->layer()->visible()); -} - -TEST_F(WindowAnimationsTest, LayerTargetVisibility) { - scoped_ptr<aura::Window> window( - aura::test::CreateTestWindowWithId(0, NULL)); - - // Layer target visibility changes according to Show/Hide. - window->Show(); - EXPECT_TRUE(window->layer()->GetTargetVisibility()); - window->Hide(); - EXPECT_FALSE(window->layer()->GetTargetVisibility()); - window->Show(); - EXPECT_TRUE(window->layer()->GetTargetVisibility()); -} - -TEST_F(WindowAnimationsTest, CrossFadeToBounds) { - ui::LayerAnimator::set_disable_animations_for_test(false); - - scoped_ptr<Window> window( - aura::test::CreateTestWindowWithId(0, NULL)); - window->SetBounds(gfx::Rect(5, 10, 320, 240)); - window->Show(); - - Layer* old_layer = window->layer(); - EXPECT_EQ(1.0f, old_layer->GetTargetOpacity()); - - // Cross fade to a larger size, as in a maximize animation. - CrossFadeToBounds(window.get(), gfx::Rect(0, 0, 640, 480)); - // Window's layer has been replaced. - EXPECT_NE(old_layer, window->layer()); - // Original layer stays opaque and stretches to new size. - EXPECT_EQ(1.0f, old_layer->GetTargetOpacity()); - EXPECT_EQ("5,10 320x240", old_layer->bounds().ToString()); - gfx::Transform grow_transform; - grow_transform.Translate(-5.f, -10.f); - grow_transform.Scale(640.f / 320.f, 480.f / 240.f); - EXPECT_EQ(grow_transform, old_layer->GetTargetTransform()); - // New layer animates in to the identity transform. - EXPECT_EQ(1.0f, window->layer()->GetTargetOpacity()); - EXPECT_EQ(gfx::Transform(), window->layer()->GetTargetTransform()); - - // Run the animations to completion. - static_cast<ui::AnimationContainerElement*>(old_layer->GetAnimator())->Step( - base::TimeTicks::Now() + base::TimeDelta::FromSeconds(1)); - static_cast<ui::AnimationContainerElement*>(window->layer()->GetAnimator())-> - Step(base::TimeTicks::Now() + base::TimeDelta::FromSeconds(1)); - - // Cross fade to a smaller size, as in a restore animation. - old_layer = window->layer(); - CrossFadeToBounds(window.get(), gfx::Rect(5, 10, 320, 240)); - // Again, window layer has been replaced. - EXPECT_NE(old_layer, window->layer()); - // Original layer fades out and stretches down to new size. - EXPECT_EQ(0.0f, old_layer->GetTargetOpacity()); - EXPECT_EQ("0,0 640x480", old_layer->bounds().ToString()); - gfx::Transform shrink_transform; - shrink_transform.Translate(5.f, 10.f); - shrink_transform.Scale(320.f / 640.f, 240.f / 480.f); - EXPECT_EQ(shrink_transform, old_layer->GetTargetTransform()); - // New layer animates in to the identity transform. - EXPECT_EQ(1.0f, window->layer()->GetTargetOpacity()); - EXPECT_EQ(gfx::Transform(), window->layer()->GetTargetTransform()); - - static_cast<ui::AnimationContainerElement*>(old_layer->GetAnimator())->Step( - base::TimeTicks::Now() + base::TimeDelta::FromSeconds(1)); - static_cast<ui::AnimationContainerElement*>(window->layer()->GetAnimator())-> - Step(base::TimeTicks::Now() + base::TimeDelta::FromSeconds(1)); -} - -} // namespace internal -} // namespace ash diff --git a/ui/views/corewm/window_util.cc b/ui/views/corewm/window_util.cc deleted file mode 100644 index 95ba75b..0000000 --- a/ui/views/corewm/window_util.cc +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ui/views/corewm/window_util.h" - -#include "ui/aura/window.h" -#include "ui/compositor/layer.h" - -namespace views { -namespace corewm { - -void DeepDeleteLayers(ui::Layer* layer) { - std::vector<ui::Layer*> children = layer->children(); - for (std::vector<ui::Layer*>::const_iterator it = children.begin(); - it != children.end(); - ++it) { - ui::Layer* child = *it; - DeepDeleteLayers(child); - } - delete layer; -} - -ui::Layer* RecreateWindowLayers(aura::Window* window, bool set_bounds) { - const gfx::Rect bounds = window->bounds(); - ui::Layer* old_layer = window->RecreateLayer(); - DCHECK(old_layer); - for (aura::Window::Windows::const_iterator it = window->children().begin(); - it != window->children().end(); - ++it) { - // Maintain the hierarchy of the detached layers. - old_layer->Add(RecreateWindowLayers(*it, set_bounds)); - } - if (set_bounds) - window->SetBounds(bounds); - return old_layer; -} - -} // namespace corewm -} // namespace views diff --git a/ui/views/corewm/window_util.h b/ui/views/corewm/window_util.h deleted file mode 100644 index 6c20e2f..0000000 --- a/ui/views/corewm/window_util.h +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef UI_VIEWS_COREWM_WINDOW_UTIL_H_ -#define UI_VIEWS_COREWM_WINDOW_UTIL_H_ - -#include "base/compiler_specific.h" -#include "ui/views/views_export.h" - -namespace aura { -class Window; -} - -namespace ui { -class Layer; -} - -namespace views { -namespace corewm { - -// Deletes |layer| and all its child layers. -VIEWS_EXPORT void DeepDeleteLayers(ui::Layer* layer); - -// Returns the existing Layer for |window| (and all its descendants) and creates -// a new layer for |window| and all its descendants. This is intended for -// animations that want to animate between the existing visuals and a new window -// state. The caller owns the return value. -// -// As a result of this |window| has freshly created layers, meaning the layers -// are all empty (nothing has been painted to them) and are sized to 0x0. Soon -// after this call you need to reset the bounds of the window. Or, you can pass -// true as the second argument to let the function do that. -VIEWS_EXPORT ui::Layer* RecreateWindowLayers(aura::Window* window, - bool set_bounds) WARN_UNUSED_RESULT; - -} // namespace corewm -} // namespace views - -#endif // UI_VIEWS_COREWM_WINDOW_UTIL_H_ diff --git a/ui/views/views.gyp b/ui/views/views.gyp index 9b3cd19..07a9d66 100644 --- a/ui/views/views.gyp +++ b/ui/views/views.gyp @@ -244,8 +244,6 @@ 'corewm/base_focus_rules.h', 'corewm/compound_event_filter.cc', 'corewm/compound_event_filter.h', - 'corewm/corewm_switches.cc', - 'corewm/corewm_switches.h', 'corewm/focus_change_event.cc', 'corewm/focus_change_event.h', 'corewm/focus_controller.cc', @@ -261,10 +259,6 @@ 'corewm/shadow_controller.h', 'corewm/shadow_types.cc', 'corewm/shadow_types.h', - 'corewm/window_animations.cc', - 'corewm/window_animations.h', - 'corewm/window_util.cc', - 'corewm/window_util.h', 'debug_utils.cc', 'debug_utils.h', 'drag_controller.h', |