Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: ui/aura/window_tracker.cc

Issue 851853002: It is time. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Trying to reup because the last upload failed. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/aura/window_tracker.h ('k') | ui/aura/window_tree_host.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 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 "ui/aura/window_tracker.h"
6
7 #include "ui/aura/window.h"
8
9 namespace aura {
10
11 WindowTracker::WindowTracker() {
12 }
13
14 WindowTracker::~WindowTracker() {
15 for (Windows::iterator i = windows_.begin(); i != windows_.end(); ++i)
16 (*i)->RemoveObserver(this);
17 }
18
19 void WindowTracker::Add(Window* window) {
20 if (windows_.count(window))
21 return;
22
23 window->AddObserver(this);
24 windows_.insert(window);
25 }
26
27 void WindowTracker::Remove(Window* window) {
28 if (windows_.count(window)) {
29 windows_.erase(window);
30 window->RemoveObserver(this);
31 }
32 }
33
34 bool WindowTracker::Contains(Window* window) {
35 return windows_.count(window) > 0;
36 }
37
38 void WindowTracker::OnWindowDestroying(Window* window) {
39 DCHECK_GT(windows_.count(window), 0u);
40 Remove(window);
41 }
42
43 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/window_tracker.h ('k') | ui/aura/window_tree_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698