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

Unified Diff: ui/views/corewm/visibility_controller.cc

Issue 11316245: Move VisibilityController to corewm. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 1 month 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/views/corewm/visibility_controller.h ('k') | ui/views/corewm/visibility_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/corewm/visibility_controller.cc
===================================================================
--- ui/views/corewm/visibility_controller.cc (revision 170313)
+++ ui/views/corewm/visibility_controller.cc (working copy)
@@ -2,22 +2,26 @@
// 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 "ui/views/corewm/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/aura/window_property.h"
#include "ui/compositor/layer.h"
+#include "ui/views/corewm/window_animations.h"
-namespace ash {
-namespace internal {
+namespace views {
+namespace corewm {
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(
- internal::kChildWindowVisibilityChangesAnimatedKey);
+ kChildWindowVisibilityChangesAnimatedKey);
}
} // namespace
@@ -28,12 +32,19 @@
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() != aura::client::WINDOW_TYPE_CONTROL &&
window->type() != aura::client::WINDOW_TYPE_UNKNOWN &&
ShouldAnimateWindow(window);
- animated = animated && AnimateOnChildWindowVisibilityChanged(window, visible);
+ animated = animated &&
+ CallAnimateOnChildWindowVisibilityChanged(window, visible);
if (!visible) {
// For window hiding animation, we want to check if the window is already
@@ -51,28 +62,26 @@
window->layer()->SetVisible(visible);
}
-} // namespace internal
-
SuspendChildWindowVisibilityAnimations::SuspendChildWindowVisibilityAnimations(
aura::Window* window)
: window_(window),
original_enabled_(window->GetProperty(
- internal::kChildWindowVisibilityChangesAnimatedKey)) {
- window_->ClearProperty(internal::kChildWindowVisibilityChangesAnimatedKey);
+ kChildWindowVisibilityChangesAnimatedKey)) {
+ window_->ClearProperty(kChildWindowVisibilityChangesAnimatedKey);
}
SuspendChildWindowVisibilityAnimations::
~SuspendChildWindowVisibilityAnimations() {
- if (original_enabled_) {
- window_->SetProperty(internal::kChildWindowVisibilityChangesAnimatedKey,
- true);
- } else {
- window_->ClearProperty(internal::kChildWindowVisibilityChangesAnimatedKey);
- }
+ if (original_enabled_)
+ window_->SetProperty(kChildWindowVisibilityChangesAnimatedKey, true);
+ else
+ window_->ClearProperty(kChildWindowVisibilityChangesAnimatedKey);
}
void SetChildWindowVisibilityChangesAnimated(aura::Window* window) {
- window->SetProperty(internal::kChildWindowVisibilityChangesAnimatedKey, true);
+ window->SetProperty(kChildWindowVisibilityChangesAnimatedKey, true);
}
-} // namespace ash
+} // namespace corewm
+} // namespace views
+
« no previous file with comments | « ui/views/corewm/visibility_controller.h ('k') | ui/views/corewm/visibility_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698