Separate Simple Backend creation from initialization.
[chromium-blink-merge.git] / ui / aura / window_destruction_observer.cc
blob20325c7bc5f166147cd10257d468cd524b4096fe
1 // Copyright 2013 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.
5 #include "ui/aura/window_destruction_observer.h"
7 namespace aura {
9 WindowDestructionObserver::WindowDestructionObserver(Window* window)
10 : window_(window), destroyed_(false) {
11 DCHECK(window_);
12 window_->AddObserver(this);
15 WindowDestructionObserver::~WindowDestructionObserver() {
16 if (!destroyed_)
17 window_->RemoveObserver(this);
20 void WindowDestructionObserver::OnWindowDestroyed(Window* window) {
21 if (window == window_)
22 destroyed_ = true;
25 } // namespace aura