| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_AURA_WINDOW_OBSERVER_H_ | 5 #ifndef UI_AURA_WINDOW_OBSERVER_H_ |
| 6 #define UI_AURA_WINDOW_OBSERVER_H_ | 6 #define UI_AURA_WINDOW_OBSERVER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "ui/aura/aura_export.h" | 9 #include "ui/aura/aura_export.h" |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 HIERARCHY_CHANGED | 24 HIERARCHY_CHANGED |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 Window* target; // The window that was added or removed. | 27 Window* target; // The window that was added or removed. |
| 28 Window* new_parent; | 28 Window* new_parent; |
| 29 Window* old_parent; | 29 Window* old_parent; |
| 30 HierarchyChangePhase phase; | 30 HierarchyChangePhase phase; |
| 31 Window* receiver; // The window receiving the notification. | 31 Window* receiver; // The window receiving the notification. |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 WindowObserver(); | |
| 35 | |
| 36 // Called when a window is added or removed. Notifications are sent to the | 34 // Called when a window is added or removed. Notifications are sent to the |
| 37 // following hierarchies in this order: | 35 // following hierarchies in this order: |
| 38 // 1. |target|. | 36 // 1. |target|. |
| 39 // 2. |target|'s child hierarchy. | 37 // 2. |target|'s child hierarchy. |
| 40 // 3. |target|'s parent hierarchy in its |old_parent| | 38 // 3. |target|'s parent hierarchy in its |old_parent| |
| 41 // (only for Changing notifications). | 39 // (only for Changing notifications). |
| 42 // 3. |target|'s parent hierarchy in its |new_parent|. | 40 // 3. |target|'s parent hierarchy in its |new_parent|. |
| 43 // (only for Changed notifications). | 41 // (only for Changed notifications). |
| 44 // This sequence is performed via the Changing and Changed notifications below | 42 // This sequence is performed via the Changing and Changed notifications below |
| 45 // before and after the change is committed. | 43 // before and after the change is committed. |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 // Called when a Window has been added to a RootWindow. | 104 // Called when a Window has been added to a RootWindow. |
| 107 virtual void OnWindowAddedToRootWindow(Window* window) {} | 105 virtual void OnWindowAddedToRootWindow(Window* window) {} |
| 108 | 106 |
| 109 // Called when a Window is about to be removed from a root Window. | 107 // Called when a Window is about to be removed from a root Window. |
| 110 // |new_root| contains the new root Window if it is being added to one | 108 // |new_root| contains the new root Window if it is being added to one |
| 111 // atomically. | 109 // atomically. |
| 112 virtual void OnWindowRemovingFromRootWindow(Window* window, | 110 virtual void OnWindowRemovingFromRootWindow(Window* window, |
| 113 Window* new_root) {} | 111 Window* new_root) {} |
| 114 | 112 |
| 115 protected: | 113 protected: |
| 116 virtual ~WindowObserver(); | 114 virtual ~WindowObserver() {} |
| 117 | |
| 118 private: | |
| 119 friend class Window; | |
| 120 | |
| 121 // Called when this is added as an observer on |window|. | |
| 122 void OnObservingWindow(Window* window); | |
| 123 | |
| 124 // Called when this is removed from the observers on |window|. | |
| 125 void OnUnobservingWindow(Window* window); | |
| 126 | |
| 127 // Tracks the number of windows being observed to track down | |
| 128 // http://crbug.com/365364. | |
| 129 int observing_; | |
| 130 | |
| 131 DISALLOW_COPY_AND_ASSIGN(WindowObserver); | |
| 132 }; | 115 }; |
| 133 | 116 |
| 134 } // namespace aura | 117 } // namespace aura |
| 135 | 118 |
| 136 #endif // UI_AURA_WINDOW_OBSERVER_H_ | 119 #endif // UI_AURA_WINDOW_OBSERVER_H_ |
| OLD | NEW |