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..cfdae47d30df9e402aaeb5e0052c89f600b97494 100644 |
--- a/ash/system/status_area_widget_delegate.cc |
+++ b/ash/system/status_area_widget_delegate.cc |
@@ -10,15 +10,43 @@ |
#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 kAnimationDurationMs = 250; |
+ |
+class StatusAreaWidgetDelegateAnimationSettings |
+ : public ui::ScopedLayerAnimationSettings { |
+ public: |
+ explicit StatusAreaWidgetDelegateAnimationSettings(ui::Layer* layer) |
+ : ui::ScopedLayerAnimationSettings(layer->GetAnimator()) { |
+ SetTransitionDuration( |
+ base::TimeDelta::FromMilliseconds(kAnimationDurationMs)); |
+ SetPreemptionStrategy( |
+ ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
+ SetTweenType(gfx::Tween::EASE_IN_OUT); |
+ } |
+ |
+ virtual ~StatusAreaWidgetDelegateAnimationSettings() {} |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(StatusAreaWidgetDelegateAnimationSettings); |
+}; |
+ |
+} // namespace |
+ |
namespace ash { |
StatusAreaWidgetDelegate::StatusAreaWidgetDelegate() |
@@ -27,6 +55,8 @@ 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); |
+ SetFillsBoundsOpaquely(false); |
} |
StatusAreaWidgetDelegate::~StatusAreaWidgetDelegate() { |
@@ -117,12 +147,17 @@ void StatusAreaWidgetDelegate::UpdateLayout() { |
layout->AddView(child); |
} |
} |
+ |
+ layer()->GetAnimator()->StopAnimating(); |
+ StatusAreaWidgetDelegateAnimationSettings settings(layer()); |
+ |
Layout(); |
UpdateWidgetSize(); |
} |
void StatusAreaWidgetDelegate::ChildPreferredSizeChanged(View* child) { |
// Need to resize the window when trays or items are added/removed. |
+ StatusAreaWidgetDelegateAnimationSettings settings(layer()); |
UpdateWidgetSize(); |
} |