blob: 0052d94e2c7b4ce34bc93bab49b9e9d4c1ba08a4 [file]
// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/wm/core/scoped_animation_disabler.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/base/class_property.h"
namespace wm {
ScopedAnimationDisabler::ScopedAnimationDisabler(aura::Window* window)
: window_(window) {
DCHECK(window_);
was_animation_enabled_ =
!window_->GetProperty(aura::client::kAnimationsDisabledKey);
if (was_animation_enabled_)
window_->SetProperty(aura::client::kAnimationsDisabledKey, true);
}
ScopedAnimationDisabler::~ScopedAnimationDisabler() {
if (was_animation_enabled_) {
DCHECK_EQ(window_->GetProperty(aura::client::kAnimationsDisabledKey), true);
window_->ClearProperty(aura::client::kAnimationsDisabledKey);
}
}
} // namespace wm