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

Unified Diff: ui/aura/window_tracker.h

Issue 1484383003: Use WindowTracker when resizing root window as it may delete other window in unit tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/aura/test/test_windows.cc ('k') | ui/aura/window_tracker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/window_tracker.h
diff --git a/ui/aura/window_tracker.h b/ui/aura/window_tracker.h
index cd839697a0f3c87694746f13e9b8b02ed7691231..005dde3ced39e5ea5a0dbaf49239c8b174818322 100644
--- a/ui/aura/window_tracker.h
+++ b/ui/aura/window_tracker.h
@@ -5,7 +5,7 @@
#ifndef UI_AURA_WINDOW_TRACKER_H_
#define UI_AURA_WINDOW_TRACKER_H_
-#include <set>
+#include <vector>
#include "base/basictypes.h"
#include "base/compiler_specific.h"
@@ -15,16 +15,19 @@
namespace aura {
// This class keeps track of a set of windows. A Window is removed either
-// explicitly by Remove(), or implicitly when the window is destroyed.
+// explicitly by Remove() or Pop(), or implicitly when the window is destroyed.
class AURA_EXPORT WindowTracker : public WindowObserver {
public:
- typedef std::set<Window*> Windows;
+ using WindowList = std::vector<Window*>;
WindowTracker();
+ explicit WindowTracker(const WindowList& windows);
~WindowTracker() override;
+ bool has_windows() const { return !windows_.empty(); }
+
// Returns the set of windows being observed.
- const std::set<Window*>& windows() const { return windows_; }
+ const std::vector<Window*>& windows() const { return windows_; }
// Adds |window| to the set of Windows being tracked.
void Add(Window* window);
@@ -36,11 +39,14 @@ class AURA_EXPORT WindowTracker : public WindowObserver {
// deleted.
bool Contains(Window* window);
+ // Removes and returns the window object from the tracking windows.
+ aura::Window* Pop();
+
// WindowObserver overrides:
void OnWindowDestroying(Window* window) override;
private:
- Windows windows_;
+ WindowList windows_;
DISALLOW_COPY_AND_ASSIGN(WindowTracker);
};
« no previous file with comments | « ui/aura/test/test_windows.cc ('k') | ui/aura/window_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698