diff options
author | dbeam@chromium.org <dbeam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-18 05:10:59 +0000 |
---|---|---|
committer | dbeam@chromium.org <dbeam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-18 05:10:59 +0000 |
commit | 3212d395332e1da75dc8624412303d6b15f9926b (patch) | |
tree | 9c7d1049d2198a2465474a91b69d7431dd245a83 /ash | |
parent | 56b4dd97a2ff7472321696c2008ff9e578bddcb1 (diff) | |
download | chromium_src-3212d395332e1da75dc8624412303d6b15f9926b.zip chromium_src-3212d395332e1da75dc8624412303d6b15f9926b.tar.gz chromium_src-3212d395332e1da75dc8624412303d6b15f9926b.tar.bz2 |
Revert 118057 - Add a simple animation when showing/hiding windows.
http://crbug.com/110024
TEST=none
Review URL: http://codereview.chromium.org/9167032
TBR=ben@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9249009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118060 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/ash.gyp | 2 | ||||
-rw-r--r-- | ash/wm/stacking_controller.cc | 5 | ||||
-rw-r--r-- | ash/wm/toplevel_layout_manager.cc | 7 | ||||
-rw-r--r-- | ash/wm/window_animations.cc | 119 | ||||
-rw-r--r-- | ash/wm/window_animations.h | 25 |
5 files changed, 1 insertions, 157 deletions
diff --git a/ash/ash.gyp b/ash/ash.gyp index 6cfd90f..a911108 100644 --- a/ash/ash.gyp +++ b/ash/ash.gyp @@ -144,8 +144,6 @@ 'wm/toplevel_layout_manager.h', 'wm/toplevel_window_event_filter.cc', 'wm/toplevel_window_event_filter.h', - 'wm/window_animations.cc', - 'wm/window_animations.h', 'wm/window_cycle_controller.cc', 'wm/window_cycle_controller.h', 'wm/window_frame.cc', diff --git a/ash/wm/stacking_controller.cc b/ash/wm/stacking_controller.cc index 3516822..08a990b 100644 --- a/ash/wm/stacking_controller.cc +++ b/ash/wm/stacking_controller.cc @@ -48,11 +48,6 @@ aura::Window* StackingController::GetDefaultParent(aura::Window* window) { switch (window->type()) { case aura::client::WINDOW_TYPE_NORMAL: case aura::client::WINDOW_TYPE_POPUP: - // TODO(beng): control windows with NULL parents should be parented to a - // unique, probably hidden, container. Adding here now for - // compatibility, since these windows were WINDOW_TYPE_POPUP - // until now. - case aura::client::WINDOW_TYPE_CONTROL: if (IsSystemModal(window)) return GetModalContainer(window); return always_on_top_controller_->GetContainer(window); diff --git a/ash/wm/toplevel_layout_manager.cc b/ash/wm/toplevel_layout_manager.cc index 47b3c01..83a8552 100644 --- a/ash/wm/toplevel_layout_manager.cc +++ b/ash/wm/toplevel_layout_manager.cc @@ -6,7 +6,6 @@ #include "ash/wm/property_util.h" #include "ash/wm/shelf_layout_manager.h" -#include "ash/wm/window_animations.h" #include "ash/wm/window_util.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/root_window.h" @@ -78,11 +77,7 @@ void ToplevelLayoutManager::OnWillRemoveWindowFromLayout( } void ToplevelLayoutManager::OnChildWindowVisibilityChanged(aura::Window* child, - bool visible) { - if (child->type() == aura::client::WINDOW_TYPE_NORMAL || - child->type() == aura::client::WINDOW_TYPE_POPUP) { - visible ? AnimateShowWindow(child) : AnimateHideWindow(child); - } + bool visibile) { UpdateShelfVisibility(); UpdateStatusAreaVisibility(); } diff --git a/ash/wm/window_animations.cc b/ash/wm/window_animations.cc deleted file mode 100644 index 228070e..0000000 --- a/ash/wm/window_animations.cc +++ /dev/null @@ -1,119 +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 "ash/wm/window_animations.h" - -#include "base/compiler_specific.h" -#include "base/logging.h" -#include "base/message_loop.h" -#include "ui/aura/window.h" -#include "ui/aura/window_observer.h" -#include "ui/gfx/compositor/layer_animation_observer.h" - -namespace ash { -namespace internal { -namespace { - -const float kWindowAnimation_HideOpacity = 0.0f; -const float kWindowAnimation_ShowOpacity = 1.0f; -const float kWindowAnimation_TranslateFactor = -0.025f; -const float kWindowAnimation_ScaleFactor = 1.05f; - -// 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() {} - - 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); - // Window may have been destroyed by this point. - if (window_) - window_->RemoveObserver(this); - MessageLoop::current()->DeleteSoon(FROM_HERE, this); - } - - // Overridden from aura::WindowObserver: - virtual void OnWindowDestroying(aura::Window* window) OVERRIDE { - DCHECK_EQ(window, window_); - layer_.reset(window_->AcquireLayer()); - window_->RemoveObserver(this); - window_ = NULL; - } - - ui::Layer* layer() { return window_ ? window_->layer() : layer_.get(); } - - aura::Window* window_; - scoped_ptr<ui::Layer> layer_; - - DISALLOW_COPY_AND_ASSIGN(HidingWindowAnimationObserver); -}; - -} // namespace - -//////////////////////////////////////////////////////////////////////////////// -// WindowAnimation, public: - -void AnimateShowWindow(aura::Window* window) { - // Set the start state pre-animation. - window->layer()->SetOpacity(kWindowAnimation_HideOpacity); - ui::Transform transform; - transform.ConcatScale(kWindowAnimation_ScaleFactor, - kWindowAnimation_ScaleFactor); - transform.ConcatTranslate( - kWindowAnimation_TranslateFactor * window->bounds().width(), - kWindowAnimation_TranslateFactor * window->bounds().height()); - window->layer()->SetTransform(transform); - - { - // Property sets within this scope will be implicitly animated. - ui::LayerAnimator::ScopedSettings settings(window->layer()->GetAnimator()); - window->layer()->SetTransform(ui::Transform()); - window->layer()->SetOpacity(kWindowAnimation_ShowOpacity); - } -} - -void AnimateHideWindow(aura::Window* window) { - // The window's layer was just hidden, but we need it to draw until it's fully - // transparent, so we show it again. This is undone once the animation is - // complete. - window->layer()->SetVisible(true); - { - // Property sets within this scope will be implicitly animated. - ui::LayerAnimator::ScopedSettings settings(window->layer()->GetAnimator()); - settings.AddImplicitObserver(new HidingWindowAnimationObserver(window)); - - window->layer()->SetOpacity(kWindowAnimation_HideOpacity); - - ui::Transform transform; - transform.ConcatScale(kWindowAnimation_ScaleFactor, - kWindowAnimation_ScaleFactor); - transform.ConcatTranslate( - kWindowAnimation_TranslateFactor * window->bounds().width(), - kWindowAnimation_TranslateFactor * window->bounds().height()); - window->layer()->SetTransform(transform); - } -} - -} // namespace internal -} // namespace ash diff --git a/ash/wm/window_animations.h b/ash/wm/window_animations.h deleted file mode 100644 index 146e1d8..0000000 --- a/ash/wm/window_animations.h +++ /dev/null @@ -1,25 +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 ASH_WM_WINDOW_ANIMATIONS_H_ -#define ASH_WM_WINDOW_ANIMATIONS_H_ -#pragma once - -namespace aura { -class Window; -} - -namespace ash { -namespace internal { - -// Implements a variety of canned animations for window transitions. - -void AnimateShowWindow(aura::Window* window); -void AnimateHideWindow(aura::Window* window); - -} // namespace internal -} // namespace ash - - -#endif // ASH_WM_WINDOW_ANIMATIONS_H_ |