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

Side by Side Diff: ui/aura/window_destruction_observer.h

Issue 12929002: Observe for window's (self) deletion during activation/focus change (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: review Created 7 years, 9 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
OLDNEW
(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(const aura::Window* window);
25
26 virtual ~WindowDestructionObserver();
27
28 // Returns true if |window_| has been observed to be destroyed.
29 bool destroyed() const;
30
31 private:
32 // aura::WindowObserver overrides:
33 virtual void OnWindowDestroyed(Window* window) OVERRIDE;
34
35 const Window* window_;
36 bool destroyed_;
37
38 DISALLOW_COPY_AND_ASSIGN(WindowDestructionObserver);
39 };
40
41 } // namespace aura
42
43 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698