closure_animation_observer.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. // Copyright 2014 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. #ifndef UI_COMPOSITOR_CLOSURE_ANIMATION_OBSERVER_H_
  5. #define UI_COMPOSITOR_CLOSURE_ANIMATION_OBSERVER_H_
  6. #include "base/callback.h"
  7. #include "ui/compositor/compositor_export.h"
  8. #include "ui/compositor/layer_animation_observer.h"
  9. namespace ui {
  10. // Runs a callback at the end of the animation. This observe also destroys
  11. // itself afterwards.
  12. class COMPOSITOR_EXPORT ClosureAnimationObserver
  13. : public ImplicitAnimationObserver {
  14. public:
  15. explicit ClosureAnimationObserver(base::OnceClosure closure);
  16. ClosureAnimationObserver(const ClosureAnimationObserver&) = delete;
  17. ClosureAnimationObserver& operator=(const ClosureAnimationObserver&) = delete;
  18. private:
  19. ~ClosureAnimationObserver() override;
  20. // ImplicitAnimationObserver:
  21. void OnImplicitAnimationsCompleted() override;
  22. base::OnceClosure closure_;
  23. };
  24. } // namespace ui
  25. #endif // UI_COMPOSITOR_CLOSURE_ANIMATION_OBSERVER_H_