OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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/common/wm/overview/cleanup_animation_observer.h" |
| 6 |
| 7 #include "ui/views/widget/widget.h" |
| 8 |
| 9 namespace ash { |
| 10 |
| 11 CleanupAnimationObserver::CleanupAnimationObserver( |
| 12 std::unique_ptr<views::Widget> widget) |
| 13 : widget_(std::move(widget)), owner_(nullptr) { |
| 14 DCHECK(widget_); |
| 15 } |
| 16 |
| 17 CleanupAnimationObserver::~CleanupAnimationObserver() {} |
| 18 |
| 19 void CleanupAnimationObserver::OnImplicitAnimationsCompleted() { |
| 20 // |widget_| may get reset if Shutdown() is called prior to this method. |
| 21 if (!widget_) |
| 22 return; |
| 23 if (owner_) { |
| 24 owner_->RemoveAndDestroyAnimationObserver(this); |
| 25 return; |
| 26 } |
| 27 delete this; |
| 28 } |
| 29 |
| 30 void CleanupAnimationObserver::SetOwner(WindowSelectorDelegate* owner) { |
| 31 owner_ = owner; |
| 32 } |
| 33 |
| 34 void CleanupAnimationObserver::Shutdown() { |
| 35 widget_.reset(); |
| 36 owner_ = nullptr; |
| 37 } |
| 38 |
| 39 } // namespace ash |
OLD | NEW |