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

Unified Diff: ash/wm/workspace/desktop_background_fade_controller.cc

Issue 11106003: Tweaks workspace animation code per latest from Nicholas. Additionally (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to trunk Created 8 years, 2 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 | « ash/wm/workspace/desktop_background_fade_controller.h ('k') | ash/wm/workspace/workspace2.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/workspace/desktop_background_fade_controller.cc
diff --git a/ash/wm/workspace/desktop_background_fade_controller.cc b/ash/wm/workspace/desktop_background_fade_controller.cc
new file mode 100644
index 0000000000000000000000000000000000000000..444cd430a1e1ff4253ccc9791d4b548010256e1b
--- /dev/null
+++ b/ash/wm/workspace/desktop_background_fade_controller.cc
@@ -0,0 +1,64 @@
+// 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/workspace/desktop_background_fade_controller.h"
+
+#include "ash/wm/window_animations.h"
+#include "ash/wm/workspace/colored_window_controller.h"
+#include "base/time.h"
+#include "ui/aura/window.h"
+#include "ui/compositor/scoped_layer_animation_settings.h"
+#include "ui/views/widget/widget.h"
+
+namespace ash {
+namespace internal {
+
+DesktopBackgroundFadeController::DesktopBackgroundFadeController(
+ aura::Window* parent,
+ aura::Window* position_above,
+ base::TimeDelta duration,
+ Direction direction) {
+ SkColor start_color, target_color;
+ ui::Tween::Type tween_type;
+ if (direction == FADE_OUT) {
+ start_color = SkColorSetARGB(0, 0, 0, 0);
+ target_color = SK_ColorBLACK;
+ tween_type = ui::Tween::EASE_IN_OUT;
+ } else {
+ start_color = SK_ColorBLACK;
+ target_color = SkColorSetARGB(0, 0, 0, 0);
+ tween_type = ui::Tween::EASE_IN_OUT;
+ }
+
+ window_controller_.reset(
+ new ColoredWindowController(parent, "DesktopFade"));
+
+ // Force the window to be directly on top of the desktop.
+ aura::Window* fade_window = window_controller_->GetWidget()->GetNativeView();
+ parent->StackChildBelow(fade_window, position_above);
+ parent->StackChildAbove(fade_window, position_above);
+ window_controller_->SetColor(start_color);
+ SetWindowVisibilityAnimationTransition(
+ window_controller_->GetWidget()->GetNativeView(), ANIMATE_NONE);
+ window_controller_->GetWidget()->Show();
+ {
+ ui::ScopedLayerAnimationSettings scoped_setter(
+ fade_window->layer()->GetAnimator());
+ scoped_setter.AddObserver(this);
+ scoped_setter.SetTweenType(tween_type);
+ scoped_setter.SetTransitionDuration(duration);
+ window_controller_->SetColor(target_color);
+ }
+}
+
+DesktopBackgroundFadeController::~DesktopBackgroundFadeController() {
+ StopObservingImplicitAnimations();
+}
+
+void DesktopBackgroundFadeController::OnImplicitAnimationsCompleted() {
+ window_controller_.reset();
+}
+
+} // namespace internal
+} // namespace ash
« no previous file with comments | « ash/wm/workspace/desktop_background_fade_controller.h ('k') | ash/wm/workspace/workspace2.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698