Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2942)

Unified Diff: ash/system/status_area_widget_delegate.cc

Issue 251193004: Animate the OverviewButtonTray (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ash/system/tray/tray_background_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « no previous file | ash/system/tray/tray_background_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698