OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef UI_AURA_WINDOW_DESTRUCTION_OBSERVER_H_ |
| 6 #define UI_AURA_WINDOW_DESTRUCTION_OBSERVER_H_ |
| 7 |
| 8 #include <set> |
| 9 |
| 10 #include "ui/aura/aura_export.h" |
| 11 #include "ui/aura/window.h" |
| 12 #include "ui/aura/window_observer.h" |
| 13 |
| 14 namespace aura { |
| 15 |
| 16 // A class for observing window (self) destruction. A side effect of a |
| 17 // window member funtion may be that the object, i.e. |this|, gets |
| 18 // deleted. This class can be used to detect such cases and to exit |
| 19 // the member function without any further access to member data. See |
| 20 // for example: aura::Window::NotifyWindowVisibilityChangedAtReceiver. |
| 21 |
| 22 class AURA_EXPORT WindowDestructionObserver : public WindowObserver { |
| 23 public: |
| 24 WindowDestructionObserver(); |
| 25 |
| 26 virtual ~WindowDestructionObserver(); |
| 27 |
| 28 // Returns true if |window| has been observed to be destroyed. |
| 29 bool was_destroyed(const Window* window) const; |
| 30 |
| 31 private: |
| 32 // aura::WindowObserver overrides: |
| 33 virtual void OnWindowDestroyed(Window* window) OVERRIDE; |
| 34 |
| 35 std::set<const Window*> destroyed_windows_; |
| 36 |
| 37 DISALLOW_COPY_AND_ASSIGN(WindowDestructionObserver); |
| 38 }; |
| 39 |
| 40 } // namespace aura |
| 41 |
| 42 #endif |
OLD | NEW |