OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 ASH_AURA_WM_WINDOW_AURA_H_ | 5 #ifndef ASH_AURA_WM_WINDOW_AURA_H_ |
6 #define ASH_AURA_WM_WINDOW_AURA_H_ | 6 #define ASH_AURA_WM_WINDOW_AURA_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ash/common/wm_window.h" | 9 #include "ash/common/wm_window.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
12 #include "ui/aura/window_observer.h" | 12 #include "ui/aura/window_observer.h" |
13 #include "ui/wm/core/transient_window_observer.h" | 13 #include "ui/wm/core/transient_window_observer.h" |
14 | 14 |
15 namespace ash { | 15 namespace ash { |
16 | 16 |
17 // WmWindowAura is tied to the life of the underlying aura::Window. | 17 // WmWindowAura is tied to the life of the underlying aura::Window. |
18 class ASH_EXPORT WmWindowAura : public WmWindow, | 18 class ASH_EXPORT WmWindowAura : public WmWindow, |
James Cook
2016/12/05 17:21:48
Please add a comment here that these are only allo
sky
2016/12/05 17:56:55
The truth is you can actually use this class in au
| |
19 public aura::WindowObserver, | 19 public aura::WindowObserver, |
20 public ::wm::TransientWindowObserver { | 20 public ::wm::TransientWindowObserver { |
21 public: | 21 public: |
22 explicit WmWindowAura(aura::Window* window); | 22 explicit WmWindowAura(aura::Window* window); |
23 // NOTE: this class is owned by the corresponding window. You shouldn't delete | 23 // NOTE: this class is owned by the corresponding window. You shouldn't delete |
24 // TODO(sky): friend deleter and make private. | 24 // TODO(sky): friend deleter and make private. |
25 ~WmWindowAura() override; | 25 ~WmWindowAura() override; |
26 | 26 |
27 // Returns a WmWindow for an aura::Window, creating if necessary. |window| may | 27 // Returns a WmWindow for an aura::Window, creating if necessary. |window| may |
28 // be null, in which case null is returned. | 28 // be null, in which case null is returned. |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
181 std::unique_ptr<views::View> CreateViewWithRecreatedLayers() override; | 181 std::unique_ptr<views::View> CreateViewWithRecreatedLayers() override; |
182 void AddObserver(WmWindowObserver* observer) override; | 182 void AddObserver(WmWindowObserver* observer) override; |
183 void RemoveObserver(WmWindowObserver* observer) override; | 183 void RemoveObserver(WmWindowObserver* observer) override; |
184 bool HasObserver(const WmWindowObserver* observer) const override; | 184 bool HasObserver(const WmWindowObserver* observer) const override; |
185 void AddTransientWindowObserver(WmTransientWindowObserver* observer) override; | 185 void AddTransientWindowObserver(WmTransientWindowObserver* observer) override; |
186 void RemoveTransientWindowObserver( | 186 void RemoveTransientWindowObserver( |
187 WmTransientWindowObserver* observer) override; | 187 WmTransientWindowObserver* observer) override; |
188 void AddLimitedPreTargetHandler(ui::EventHandler* handler) override; | 188 void AddLimitedPreTargetHandler(ui::EventHandler* handler) override; |
189 void RemoveLimitedPreTargetHandler(ui::EventHandler* handler) override; | 189 void RemoveLimitedPreTargetHandler(ui::EventHandler* handler) override; |
190 | 190 |
191 private: | 191 protected: |
192 // Returns true if a WmWindowAura has been created for |window|. | |
193 static bool HasInstance(const aura::Window* window); | |
194 | |
195 base::ObserverList<WmWindowObserver>& observers() { return observers_; } | |
196 | |
192 // aura::WindowObserver: | 197 // aura::WindowObserver: |
193 void OnWindowHierarchyChanging(const HierarchyChangeParams& params) override; | 198 void OnWindowHierarchyChanging(const HierarchyChangeParams& params) override; |
194 void OnWindowHierarchyChanged(const HierarchyChangeParams& params) override; | 199 void OnWindowHierarchyChanged(const HierarchyChangeParams& params) override; |
195 void OnWindowStackingChanged(aura::Window* window) override; | 200 void OnWindowStackingChanged(aura::Window* window) override; |
196 void OnWindowPropertyChanged(aura::Window* window, | 201 void OnWindowPropertyChanged(aura::Window* window, |
197 const void* key, | 202 const void* key, |
198 intptr_t old) override; | 203 intptr_t old) override; |
199 void OnWindowBoundsChanged(aura::Window* window, | 204 void OnWindowBoundsChanged(aura::Window* window, |
200 const gfx::Rect& old_bounds, | 205 const gfx::Rect& old_bounds, |
201 const gfx::Rect& new_bounds) override; | 206 const gfx::Rect& new_bounds) override; |
202 void OnWindowDestroying(aura::Window* window) override; | 207 void OnWindowDestroying(aura::Window* window) override; |
203 void OnWindowDestroyed(aura::Window* window) override; | 208 void OnWindowDestroyed(aura::Window* window) override; |
204 void OnWindowVisibilityChanging(aura::Window* window, bool visible) override; | 209 void OnWindowVisibilityChanging(aura::Window* window, bool visible) override; |
205 void OnWindowVisibilityChanged(aura::Window* window, bool visible) override; | 210 void OnWindowVisibilityChanged(aura::Window* window, bool visible) override; |
206 void OnWindowTitleChanged(aura::Window* window) override; | 211 void OnWindowTitleChanged(aura::Window* window) override; |
207 | 212 |
208 // ::wm::TransientWindowObserver overrides: | 213 // ::wm::TransientWindowObserver overrides: |
209 void OnTransientChildAdded(aura::Window* window, | 214 void OnTransientChildAdded(aura::Window* window, |
210 aura::Window* transient) override; | 215 aura::Window* transient) override; |
211 void OnTransientChildRemoved(aura::Window* window, | 216 void OnTransientChildRemoved(aura::Window* window, |
212 aura::Window* transient) override; | 217 aura::Window* transient) override; |
213 | 218 |
219 private: | |
214 aura::Window* window_; | 220 aura::Window* window_; |
215 | 221 |
216 base::ObserverList<WmWindowObserver> observers_; | 222 base::ObserverList<WmWindowObserver> observers_; |
217 | 223 |
218 bool added_transient_observer_ = false; | 224 bool added_transient_observer_ = false; |
219 base::ObserverList<WmTransientWindowObserver> transient_observers_; | 225 base::ObserverList<WmTransientWindowObserver> transient_observers_; |
220 | 226 |
221 DISALLOW_COPY_AND_ASSIGN(WmWindowAura); | 227 DISALLOW_COPY_AND_ASSIGN(WmWindowAura); |
222 }; | 228 }; |
223 | 229 |
224 } // namespace ash | 230 } // namespace ash |
225 | 231 |
226 #endif // ASH_AURA_WM_WINDOW_AURA_H_ | 232 #endif // ASH_AURA_WM_WINDOW_AURA_H_ |
OLD | NEW |