| 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 |
| 34 // Called when a window is added or removed. Notifications are sent to the | 36 // Called when a window is added or removed. Notifications are sent to the |
| 35 // following hierarchies in this order: | 37 // following hierarchies in this order: |
| 36 // 1. |target|. | 38 // 1. |target|. |
| 37 // 2. |target|'s child hierarchy. | 39 // 2. |target|'s child hierarchy. |
| 38 // 3. |target|'s parent hierarchy in its |old_parent| | 40 // 3. |target|'s parent hierarchy in its |old_parent| |
| 39 // (only for Changing notifications). | 41 // (only for Changing notifications). |
| 40 // 3. |target|'s parent hierarchy in its |new_parent|. | 42 // 3. |target|'s parent hierarchy in its |new_parent|. |
| 41 // (only for Changed notifications). | 43 // (only for Changed notifications). |
| 42 // This sequence is performed via the Changing and Changed notifications below | 44 // This sequence is performed via the Changing and Changed notifications below |
| 43 // before and after the change is committed. | 45 // before and after the change is committed. |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 // Called when a Window has been added to a RootWindow. | 106 // Called when a Window has been added to a RootWindow. |
| 105 virtual void OnWindowAddedToRootWindow(Window* window) {} | 107 virtual void OnWindowAddedToRootWindow(Window* window) {} |
| 106 | 108 |
| 107 // Called when a Window is about to be removed from a root Window. | 109 // Called when a Window is about to be removed from a root Window. |
| 108 // |new_root| contains the new root Window if it is being added to one | 110 // |new_root| contains the new root Window if it is being added to one |
| 109 // atomically. | 111 // atomically. |
| 110 virtual void OnWindowRemovingFromRootWindow(Window* window, | 112 virtual void OnWindowRemovingFromRootWindow(Window* window, |
| 111 Window* new_root) {} | 113 Window* new_root) {} |
| 112 | 114 |
| 113 protected: | 115 protected: |
| 114 virtual ~WindowObserver() {} | 116 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); |
| 115 }; | 132 }; |
| 116 | 133 |
| 117 } // namespace aura | 134 } // namespace aura |
| 118 | 135 |
| 119 #endif // UI_AURA_WINDOW_OBSERVER_H_ | 136 #endif // UI_AURA_WINDOW_OBSERVER_H_ |
| OLD | NEW |