1 // Copyright 2018 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "ash/scoped_animation_disabler.h" 6 7 #include "ui/aura/client/aura_constants.h" 8 #include "ui/base/class_property.h" 9 10 namespace ash { 11 ScopedAnimationDisabler(aura::Window * window)12ScopedAnimationDisabler::ScopedAnimationDisabler(aura::Window* window) 13 : window_(window) { 14 DCHECK(window_); 15 needs_disable_ = !window_->GetProperty(aura::client::kAnimationsDisabledKey); 16 if (needs_disable_) 17 window_->SetProperty(aura::client::kAnimationsDisabledKey, true); 18 } 19 ~ScopedAnimationDisabler()20ScopedAnimationDisabler::~ScopedAnimationDisabler() { 21 if (needs_disable_) { 22 DCHECK_EQ(window_->GetProperty(aura::client::kAnimationsDisabledKey), true); 23 window_->ClearProperty(aura::client::kAnimationsDisabledKey); 24 } 25 } 26 27 } // namespace ash 28