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

Unified Diff: ui/wm/core/visibility_controller.cc

Issue 851853002: It is time. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Trying to reup because the last upload failed. Created 5 years, 11 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 | « ui/wm/core/visibility_controller.h ('k') | ui/wm/core/visibility_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/wm/core/visibility_controller.cc
diff --git a/ui/wm/core/visibility_controller.cc b/ui/wm/core/visibility_controller.cc
deleted file mode 100644
index fc187a949028c0d6b7683d5b78f8b041abb99782..0000000000000000000000000000000000000000
--- a/ui/wm/core/visibility_controller.cc
+++ /dev/null
@@ -1,89 +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 "ui/wm/core/visibility_controller.h"
-
-#include "ui/aura/window.h"
-#include "ui/aura/window_property.h"
-#include "ui/compositor/layer.h"
-#include "ui/wm/core/window_animations.h"
-
-namespace wm {
-
-namespace {
-
-// Property set on all windows whose child windows' visibility changes are
-// animated.
-DEFINE_WINDOW_PROPERTY_KEY(
- bool, kChildWindowVisibilityChangesAnimatedKey, false);
-
-bool ShouldAnimateWindow(aura::Window* window) {
- return window->parent() && window->parent()->GetProperty(
- kChildWindowVisibilityChangesAnimatedKey);
-}
-
-} // namespace
-
-VisibilityController::VisibilityController() {
-}
-
-VisibilityController::~VisibilityController() {
-}
-
-bool VisibilityController::CallAnimateOnChildWindowVisibilityChanged(
- aura::Window* window,
- bool visible) {
- return AnimateOnChildWindowVisibilityChanged(window, visible);
-}
-
-void VisibilityController::UpdateLayerVisibility(aura::Window* window,
- bool visible) {
- bool animated = window->type() != ui::wm::WINDOW_TYPE_CONTROL &&
- window->type() != ui::wm::WINDOW_TYPE_UNKNOWN &&
- ShouldAnimateWindow(window);
- animated = animated &&
- CallAnimateOnChildWindowVisibilityChanged(window, visible);
-
- // If we're already in the process of hiding don't do anything. Otherwise we
- // may end up prematurely canceling the animation.
- // This does not check opacity as when fading out a visibility change should
- // also be scheduled (to do otherwise would mean the window can not be seen,
- // opacity is 0, yet the window is marked as visible) (see CL 132903003).
- // TODO(vollick): remove this.
- if (!visible &&
- window->layer()->GetAnimator()->IsAnimatingProperty(
- ui::LayerAnimationElement::VISIBILITY) &&
- !window->layer()->GetTargetVisibility()) {
- return;
- }
-
- // 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);
-}
-
-SuspendChildWindowVisibilityAnimations::SuspendChildWindowVisibilityAnimations(
- aura::Window* window)
- : window_(window),
- original_enabled_(window->GetProperty(
- kChildWindowVisibilityChangesAnimatedKey)) {
- window_->ClearProperty(kChildWindowVisibilityChangesAnimatedKey);
-}
-
-SuspendChildWindowVisibilityAnimations::
- ~SuspendChildWindowVisibilityAnimations() {
- if (original_enabled_)
- window_->SetProperty(kChildWindowVisibilityChangesAnimatedKey, true);
- else
- window_->ClearProperty(kChildWindowVisibilityChangesAnimatedKey);
-}
-
-void SetChildWindowVisibilityChangesAnimated(aura::Window* window) {
- window->SetProperty(kChildWindowVisibilityChangesAnimatedKey, true);
-}
-
-} // namespace wm
-
« no previous file with comments | « ui/wm/core/visibility_controller.h ('k') | ui/wm/core/visibility_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698