summaryrefslogtreecommitdiffstats
path: root/ash/system/tray
diff options
context:
space:
mode:
authorjonross@chromium.org <jonross@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-13 20:31:34 +0000
committerjonross@chromium.org <jonross@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-13 20:31:34 +0000
commit399aa22e04f289f496f60ad23379a098e389d6a1 (patch)
treebef7554e5da5fb336d9dbc48a8686cd381efeebb /ash/system/tray
parent7a59d98840b8baf6f606dfd2948b66e51669acc3 (diff)
downloadchromium_src-399aa22e04f289f496f60ad23379a098e389d6a1.zip
chromium_src-399aa22e04f289f496f60ad23379a098e389d6a1.tar.gz
chromium_src-399aa22e04f289f496f60ad23379a098e389d6a1.tar.bz2
Revert animation of Overview Button Tray
Initial change has a race condition that can cause the system tray and other items to become, and stay visible. Reverting to unblock dev. Revert "Animate the OverviewButtonTray" This reverts commit f2eb09cd51c6c3dec830abd6613c0df130b7c08f. Original review: https://codereview.chromium.org/251193004/ TBR=oshima@chromium.org BUG=372285 Review URL: https://codereview.chromium.org/281793002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270189 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/system/tray')
-rw-r--r--ash/system/tray/tray_background_view.cc81
-rw-r--r--ash/system/tray/tray_background_view.h24
2 files changed, 9 insertions, 96 deletions
diff --git a/ash/system/tray/tray_background_view.cc b/ash/system/tray/tray_background_view.cc
index 2ece371..fc24c14 100644
--- a/ash/system/tray/tray_background_view.cc
+++ b/ash/system/tray/tray_background_view.cc
@@ -22,17 +22,12 @@
#include "ui/aura/window.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/base/resource/resource_bundle.h"
-#include "ui/compositor/layer.h"
-#include "ui/compositor/layer_animation_element.h"
-#include "ui/compositor/scoped_layer_animation_settings.h"
-#include "ui/gfx/animation/tween.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/image/image_skia_operations.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/screen.h"
#include "ui/gfx/skia_util.h"
-#include "ui/gfx/transform.h"
#include "ui/views/background.h"
#include "ui/views/layout/box_layout.h"
@@ -42,15 +37,7 @@ const int kTrayBackgroundAlpha = 100;
const int kTrayBackgroundHoverAlpha = 150;
const SkColor kTrayBackgroundPressedColor = SkColorSetRGB(66, 129, 244);
-const int kAnimationDurationForPopupMs = 200;
-
-// Duration of opacity animation for visibility changes.
-const int kAnimationDurationForVisibilityMs = 250;
-
-// When becoming visible delay the animation so that StatusAreaWidgetDelegate
-// can animate sibling views out of the position to be occuped by the
-// TrayBackgroundView.
-const int kShowAnimationDelayMs = 100;
+const int kAnimationDurationForPopupMS = 200;
} // namespace
@@ -320,9 +307,6 @@ TrayBackgroundView::TrayBackgroundView(StatusAreaWidget* status_area_widget)
tray_container_ = new TrayContainer(shelf_alignment_);
SetContents(tray_container_);
tray_event_filter_.reset(new TrayEventFilter);
-
- SetPaintToLayer(true);
- SetFillsBoundsOpaquely(false);
}
TrayBackgroundView::~TrayBackgroundView() {
@@ -335,53 +319,6 @@ void TrayBackgroundView::Initialize() {
SetTrayBorder();
}
-void TrayBackgroundView::SetVisible(bool visible) {
- if (visible == this->visible())
- return;
-
- if (visible) {
- // The alignment of the shelf can change while the TrayBackgroundView is
- // hidden. Reset the offscreen transform so that the animation to becoming
- // visible reflects the current layout.
- HideTransformation();
- // SetVisible(false) is defered until the animation for hiding is done.
- // Otherwise the view is immediately hidden and the animation does not
- // render.
- views::View::SetVisible(visible);
- }
-
- layer()->GetAnimator()->StopAnimating();
- ui::ScopedLayerAnimationSettings animation(layer()->GetAnimator());
- animation.SetTransitionDuration(base::TimeDelta::FromMilliseconds(
- kAnimationDurationForVisibilityMs));
- animation.SetPreemptionStrategy(
- ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
-
- if (visible) {
- animation.SetTweenType(gfx::Tween::EASE_OUT);
- // Show is delayed so as to allow time for other children of
- // StatusAreaWidget to begin animating to their new positions.
- layer()->GetAnimator()->SchedulePauseForProperties(
- base::TimeDelta::FromMilliseconds(kShowAnimationDelayMs),
- ui::LayerAnimationElement::OPACITY |
- ui::LayerAnimationElement::TRANSFORM);
- // layer()->SetVisible(true) is handled by views::View::SetVisible(true) so
- // we do not need to apply that change while becoming visible.
- layer()->SetOpacity(1.0f);
- gfx::Transform transform;
- transform.Translate(0.0f, 0.0f);
- layer()->SetTransform(transform);
- } else {
- // Listen only to the hide animation. As we cannot turn off visibility
- // until the animation is over.
- animation.AddObserver(this);
- animation.SetTweenType(gfx::Tween::EASE_IN);
- layer()->SetOpacity(0.0f);
- layer()->SetVisible(false);
- HideTransformation();
- }
-}
-
const char* TrayBackgroundView::GetClassName() const {
return kViewClassName;
}
@@ -483,20 +420,6 @@ void TrayBackgroundView::SetTrayBorder() {
top_edge, left_edge, bottom_edge, right_edge));
}
-void TrayBackgroundView::OnImplicitAnimationsCompleted() {
- views::View::SetVisible(false);
-}
-
-void TrayBackgroundView::HideTransformation() {
- gfx::Transform transform;
- if (shelf_alignment_ == SHELF_ALIGNMENT_BOTTOM ||
- shelf_alignment_ == SHELF_ALIGNMENT_TOP)
- transform.Translate(width(), 0.0f);
- else
- transform.Translate(0.0f, height());
- layer()->SetTransform(transform);
-}
-
void TrayBackgroundView::InitializeBubbleAnimations(
views::Widget* bubble_widget) {
wm::SetWindowVisibilityAnimationType(
@@ -507,7 +430,7 @@ void TrayBackgroundView::InitializeBubbleAnimations(
wm::ANIMATE_HIDE);
wm::SetWindowVisibilityAnimationDuration(
bubble_widget->GetNativeWindow(),
- base::TimeDelta::FromMilliseconds(kAnimationDurationForPopupMs));
+ base::TimeDelta::FromMilliseconds(kAnimationDurationForPopupMS));
}
aura::Window* TrayBackgroundView::GetBubbleWindowContainer() const {
diff --git a/ash/system/tray/tray_background_view.h b/ash/system/tray/tray_background_view.h
index ce3c163..365e63a 100644
--- a/ash/system/tray/tray_background_view.h
+++ b/ash/system/tray/tray_background_view.h
@@ -9,7 +9,6 @@
#include "ash/shelf/background_animator.h"
#include "ash/shelf/shelf_types.h"
#include "ash/system/tray/actionable_view.h"
-#include "ui/compositor/layer_animation_observer.h"
#include "ui/views/bubble/tray_bubble_view.h"
namespace ash {
@@ -19,13 +18,12 @@ class TrayEventFilter;
class TrayBackground;
// Base class for children of StatusAreaWidget: SystemTray, WebNotificationTray,
-// LogoutButtonTray, OverviewButtonTray.
+// LogoutButtonTray.
// This class handles setting and animating the background when the Launcher
// his shown/hidden. It also inherits from ActionableView so that the tray
// items can override PerformAction when clicked on.
class ASH_EXPORT TrayBackgroundView : public ActionableView,
- public BackgroundAnimatorDelegate,
- public ui::ImplicitAnimationObserver {
+ public BackgroundAnimatorDelegate {
public:
static const char kViewClassName[];
@@ -40,11 +38,11 @@ class ASH_EXPORT TrayBackgroundView : public ActionableView,
void set_size(const gfx::Size& size) { size_ = size; }
- // views::View:
+ // Overridden from views::View.
virtual gfx::Size GetPreferredSize() OVERRIDE;
protected:
- // views::View:
+ // Overridden from views::View.
virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE;
virtual void ChildVisibilityChanged(View* child) OVERRIDE;
virtual void ViewHierarchyChanged(
@@ -65,8 +63,7 @@ class ASH_EXPORT TrayBackgroundView : public ActionableView,
// Called after the tray has been added to the widget containing it.
virtual void Initialize();
- // views::View:
- virtual void SetVisible(bool visible) OVERRIDE;
+ // Overridden from views::View.
virtual const char* GetClassName() const OVERRIDE;
virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE;
virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE;
@@ -74,11 +71,11 @@ class ASH_EXPORT TrayBackgroundView : public ActionableView,
virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE;
virtual void AboutToRequestFocusFromTabTraversal(bool reverse) OVERRIDE;
- // ActionableView:
+ // Overridden from ActionableView.
virtual bool PerformAction(const ui::Event& event) OVERRIDE;
virtual gfx::Rect GetFocusBounds() OVERRIDE;
- // BackgroundAnimatorDelegate:
+ // Overridden from BackgroundAnimatorDelegate.
virtual void UpdateBackground(int alpha) OVERRIDE;
// Called whenever the shelf alignment changes.
@@ -155,13 +152,6 @@ class ASH_EXPORT TrayBackgroundView : public ActionableView,
// Sets the border based on the position of the view.
void SetTrayBorder();
- // ui::ImplicitAnimationObserver:
- virtual void OnImplicitAnimationsCompleted() OVERRIDE;
-
- // Applies transformations to the |layer()| to animate the view when
- // SetVisible(false) is called.
- void HideTransformation();
-
// Unowned pointer to parent widget.
StatusAreaWidget* status_area_widget_;