summaryrefslogtreecommitdiffstats
path: root/ash/wm/visibility_controller.cc
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-30 01:32:02 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-30 01:32:02 +0000
commitb5756e205e33a1c982d5a97bc3b352f1850c8519 (patch)
tree523c101267d84a6598ff940d63f0592db15744a5 /ash/wm/visibility_controller.cc
parentfa73836b5058c72ce7d0d052e2d133da8f43629d (diff)
downloadchromium_src-b5756e205e33a1c982d5a97bc3b352f1850c8519.zip
chromium_src-b5756e205e33a1c982d5a97bc3b352f1850c8519.tar.gz
chromium_src-b5756e205e33a1c982d5a97bc3b352f1850c8519.tar.bz2
Move VisibilityController to corewm.
I had to add a subclass to Ash for the time being to allow Ash to call its method for animating windows, which handles a few animation types corewm doesn't know about. I'd like to clean this up a bit in a future CL, see my TODO. http://crbug.com/158115 R=sky@chromium.org Review URL: https://codereview.chromium.org/11316245 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170328 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/wm/visibility_controller.cc')
-rw-r--r--ash/wm/visibility_controller.cc78
1 files changed, 0 insertions, 78 deletions
diff --git a/ash/wm/visibility_controller.cc b/ash/wm/visibility_controller.cc
deleted file mode 100644
index 370259c..0000000
--- a/ash/wm/visibility_controller.cc
+++ /dev/null
@@ -1,78 +0,0 @@
-// 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/visibility_controller.h"
-
-#include "ash/shell.h"
-#include "ash/wm/window_animations.h"
-#include "ash/wm/window_properties.h"
-#include "ui/aura/window.h"
-#include "ui/compositor/layer.h"
-
-namespace ash {
-namespace internal {
-
-namespace {
-
-bool ShouldAnimateWindow(aura::Window* window) {
- return window->parent() && window->parent()->GetProperty(
- internal::kChildWindowVisibilityChangesAnimatedKey);
-}
-
-} // namespace
-
-VisibilityController::VisibilityController() {
-}
-
-VisibilityController::~VisibilityController() {
-}
-
-void VisibilityController::UpdateLayerVisibility(aura::Window* window,
- bool visible) {
- bool animated = window->type() != aura::client::WINDOW_TYPE_CONTROL &&
- window->type() != aura::client::WINDOW_TYPE_UNKNOWN &&
- ShouldAnimateWindow(window);
- animated = animated && AnimateOnChildWindowVisibilityChanged(window, visible);
-
- if (!visible) {
- // For window hiding animation, we want to check if the window is already
- // animating, and not do SetVisible(false) if it is.
- // TODO(vollick): remove this.
- animated = animated || (window->layer()->GetAnimator()->
- IsAnimatingProperty(ui::LayerAnimationElement::OPACITY) &&
- window->layer()->GetTargetOpacity() == 0.0f);
- }
-
- // When a window is made visible, we always make its layer visible
- // immediately. When a window is hidden, the layer must be left visible and
- // only made not visible once the animation is complete.
- if (!animated || visible)
- window->layer()->SetVisible(visible);
-}
-
-} // namespace internal
-
-SuspendChildWindowVisibilityAnimations::SuspendChildWindowVisibilityAnimations(
- aura::Window* window)
- : window_(window),
- original_enabled_(window->GetProperty(
- internal::kChildWindowVisibilityChangesAnimatedKey)) {
- window_->ClearProperty(internal::kChildWindowVisibilityChangesAnimatedKey);
-}
-
-SuspendChildWindowVisibilityAnimations::
- ~SuspendChildWindowVisibilityAnimations() {
- if (original_enabled_) {
- window_->SetProperty(internal::kChildWindowVisibilityChangesAnimatedKey,
- true);
- } else {
- window_->ClearProperty(internal::kChildWindowVisibilityChangesAnimatedKey);
- }
-}
-
-void SetChildWindowVisibilityChangesAnimated(aura::Window* window) {
- window->SetProperty(internal::kChildWindowVisibilityChangesAnimatedKey, true);
-}
-
-} // namespace ash