Index: ash/system/status_area_widget_delegate.cc |
diff --git a/ash/system/status_area_widget_delegate.cc b/ash/system/status_area_widget_delegate.cc |
index babe66d1474ae7f9fc5d9d0e4d15dfec3e0cf756..229023103f00d5493438e3e5d4dccab67a2aec98 100644 |
--- a/ash/system/status_area_widget_delegate.cc |
+++ b/ash/system/status_area_widget_delegate.cc |
@@ -10,15 +10,25 @@ |
#include "ash/shell.h" |
#include "ash/shell_window_ids.h" |
#include "ash/system/tray/tray_constants.h" |
+#include "base/memory/scoped_ptr.h" |
#include "base/strings/utf_string_conversions.h" |
#include "ui/aura/window_event_dispatcher.h" |
#include "ui/base/resource/resource_bundle.h" |
+#include "ui/compositor/layer.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.h" |
#include "ui/views/accessible_pane_view.h" |
#include "ui/views/layout/grid_layout.h" |
#include "ui/views/widget/widget.h" |
+namespace { |
+ |
+const int kAnimationDuration = 250; |
+ |
+} // namespace |
+ |
namespace ash { |
StatusAreaWidgetDelegate::StatusAreaWidgetDelegate() |
@@ -27,6 +37,7 @@ StatusAreaWidgetDelegate::StatusAreaWidgetDelegate() |
// Allow the launcher to surrender the focus to another window upon |
// navigation completion by the user. |
set_allow_deactivate_on_esc(true); |
+ SetPaintToLayer(true); |
} |
StatusAreaWidgetDelegate::~StatusAreaWidgetDelegate() { |
@@ -117,12 +128,20 @@ void StatusAreaWidgetDelegate::UpdateLayout() { |
layout->AddView(child); |
} |
} |
+ |
+ layer()->GetAnimator()->StopAnimating(); |
+ scoped_ptr<ui::ScopedLayerAnimationSettings> animation; |
+ animation.reset(SetupAnimationForLayer(layer())); |
+ |
Layout(); |
UpdateWidgetSize(); |
} |
void StatusAreaWidgetDelegate::ChildPreferredSizeChanged(View* child) { |
// Need to resize the window when trays or items are added/removed. |
+ scoped_ptr<ui::ScopedLayerAnimationSettings> animation; |
+ animation.reset(SetupAnimationForLayer(layer())); |
+ |
UpdateWidgetSize(); |
} |
@@ -135,4 +154,18 @@ void StatusAreaWidgetDelegate::UpdateWidgetSize() { |
GetWidget()->SetSize(GetPreferredSize()); |
} |
+ui::ScopedLayerAnimationSettings* |
+ StatusAreaWidgetDelegate::SetupAnimationForLayer(ui::Layer* layer) { |
flackr
2014/05/06 15:42:11
Use anonymous namespace, though it'd probably be b
jonross
2014/05/07 13:52:36
Done.
|
+ if (!layer) |
+ return NULL; |
+ ui::ScopedLayerAnimationSettings* settings = |
+ new ui::ScopedLayerAnimationSettings(layer->GetAnimator()); |
+ settings->SetTransitionDuration( |
+ base::TimeDelta::FromMilliseconds(kAnimationDuration)); |
+ settings->SetPreemptionStrategy( |
+ ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
+ settings->SetTweenType(gfx::Tween::EASE_IN_OUT); |
+ return settings; |
+} |
+ |
} // namespace ash |