| Index: ui/aura/window_destruction_observer.cc
|
| diff --git a/ui/aura/window_destruction_observer.cc b/ui/aura/window_destruction_observer.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..a4973a3ddb4dcccdd68bf98bf2493ec25c2314d8
|
| --- /dev/null
|
| +++ b/ui/aura/window_destruction_observer.cc
|
| @@ -0,0 +1,29 @@
|
| +// Copyright 2013 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "ui/aura/window_destruction_observer.h"
|
| +
|
| +namespace aura {
|
| +
|
| +WindowDestructionObserver::WindowDestructionObserver(Window* window)
|
| + : window_(window), destroyed_(false) {
|
| + DCHECK(window_);
|
| + window_->AddObserver(this);
|
| +}
|
| +
|
| +WindowDestructionObserver::~WindowDestructionObserver() {
|
| + if (!destroyed_)
|
| + window_->RemoveObserver(this);
|
| +}
|
| +
|
| +bool WindowDestructionObserver::destroyed() const {
|
| + return destroyed_;
|
| +}
|
| +
|
| +void WindowDestructionObserver::OnWindowDestroyed(Window* window) {
|
| + if (window == window_)
|
| + destroyed_ = true;
|
| +}
|
| +
|
| +} // namespace aura
|
|
|