summaryrefslogtreecommitdiffstats
path: root/ui/aura/window_observer.cc
blob: 24d51d47df0a74116cb589dcdd29781bd72b7055 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright 2014 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_observer.h"

#include "base/logging.h"
#include "ui/aura/window.h"

namespace aura {

WindowObserver::WindowObserver() : observing_(0) {
}

WindowObserver::~WindowObserver() {
  // TODO(flackr): Remove this check and observing_ counter when the cause of
  // http://crbug.com/365364 is discovered.
  CHECK_EQ(0, observing_);
}

void WindowObserver::OnObservingWindow(aura::Window* window) {
  if (!window->HasObserver(this))
    observing_++;
}

void WindowObserver::OnUnobservingWindow(aura::Window* window) {
  if (window->HasObserver(this))
    observing_--;
}

}  // namespace aura