MD Downloads: prevent search text from overlapping with the cancel search (X)
[chromium-blink-merge.git] / ui / aura / window_tracker.h
blobcd839697a0f3c87694746f13e9b8b02ed7691231
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.
5 #ifndef UI_AURA_WINDOW_TRACKER_H_
6 #define UI_AURA_WINDOW_TRACKER_H_
8 #include <set>
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "ui/aura/aura_export.h"
13 #include "ui/aura/window_observer.h"
15 namespace aura {
17 // This class keeps track of a set of windows. A Window is removed either
18 // explicitly by Remove(), or implicitly when the window is destroyed.
19 class AURA_EXPORT WindowTracker : public WindowObserver {
20 public:
21 typedef std::set<Window*> Windows;
23 WindowTracker();
24 ~WindowTracker() override;
26 // Returns the set of windows being observed.
27 const std::set<Window*>& windows() const { return windows_; }
29 // Adds |window| to the set of Windows being tracked.
30 void Add(Window* window);
32 // Removes |window| from the set of windows being tracked.
33 void Remove(Window* window);
35 // Returns true if |window| was previously added and has not been removed or
36 // deleted.
37 bool Contains(Window* window);
39 // WindowObserver overrides:
40 void OnWindowDestroying(Window* window) override;
42 private:
43 Windows windows_;
45 DISALLOW_COPY_AND_ASSIGN(WindowTracker);
48 } // namespace aura
50 #endif // UI_AURA_WINDOW_TRACKER_H_