| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_WM_PUBLIC_TRANSIENT_WINDOW_CLIENT_H_ | 5 #ifndef UI_AURA_CLIENT_TRANSIENT_WINDOW_CLIENT_H_ |
| 6 #define UI_WM_PUBLIC_TRANSIENT_WINDOW_CLIENT_H_ | 6 #define UI_AURA_CLIENT_TRANSIENT_WINDOW_CLIENT_H_ |
| 7 | 7 |
| 8 #include "ui/aura/aura_export.h" | 8 #include "ui/aura/aura_export.h" |
| 9 | 9 |
| 10 namespace aura { | 10 namespace aura { |
| 11 | 11 |
| 12 class Window; | 12 class Window; |
| 13 | 13 |
| 14 namespace client { | 14 namespace client { |
| 15 | 15 |
| 16 class TransientWindowClientObserver; |
| 17 |
| 16 // TransientWindowClient is used to add or remove transient windows. Transient | 18 // TransientWindowClient is used to add or remove transient windows. Transient |
| 17 // children get the following behavior: | 19 // children get the following behavior: |
| 18 // . The transient parent destroys any transient children when it is | 20 // . The transient parent destroys any transient children when it is |
| 19 // destroyed. This means a transient child is destroyed if either its parent | 21 // destroyed. This means a transient child is destroyed if either its parent |
| 20 // or transient parent is destroyed. | 22 // or transient parent is destroyed. |
| 21 // . If a transient child and its transient parent share the same parent, then | 23 // . If a transient child and its transient parent share the same parent, then |
| 22 // transient children are always ordered above the transient parent. | 24 // transient children are always ordered above the transient parent. |
| 23 // Transient windows are typically used for popups and menus. | 25 // Transient windows are typically used for popups and menus. |
| 24 // TODO(sky): nuke this class and replace with calls to TransientWindowManager. | |
| 25 // This is temporary until we start moving to ui/wm. | |
| 26 class AURA_EXPORT TransientWindowClient { | 26 class AURA_EXPORT TransientWindowClient { |
| 27 public: | 27 public: |
| 28 virtual void AddTransientChild(Window* parent, Window* child) = 0; | 28 virtual void AddTransientChild(Window* parent, Window* child) = 0; |
| 29 virtual void RemoveTransientChild(Window* parent, Window* child) = 0; | 29 virtual void RemoveTransientChild(Window* parent, Window* child) = 0; |
| 30 virtual Window* GetTransientParent(Window* window) = 0; | 30 virtual Window* GetTransientParent(Window* window) = 0; |
| 31 virtual const Window* GetTransientParent(const Window* window) = 0; | 31 virtual const Window* GetTransientParent(const Window* window) = 0; |
| 32 virtual void AddObserver(TransientWindowClientObserver* observer) = 0; |
| 33 virtual void RemoveObserver(TransientWindowClientObserver* observer) = 0; |
| 32 | 34 |
| 33 protected: | 35 protected: |
| 34 virtual ~TransientWindowClient() {} | 36 virtual ~TransientWindowClient() {} |
| 35 }; | 37 }; |
| 36 | 38 |
| 37 // Sets/gets the TransientWindowClient. This does *not* take ownership of | 39 // Sets/gets the TransientWindowClient. This does *not* take ownership of |
| 38 // |client|. It is assumed the caller will invoke SetTransientWindowClient(NULL) | 40 // |client|. It is assumed the caller will invoke SetTransientWindowClient(NULL) |
| 39 // before deleting |client|. | 41 // before deleting |client|. |
| 40 AURA_EXPORT void SetTransientWindowClient(TransientWindowClient* client); | 42 AURA_EXPORT void SetTransientWindowClient(TransientWindowClient* client); |
| 41 AURA_EXPORT TransientWindowClient* GetTransientWindowClient(); | 43 AURA_EXPORT TransientWindowClient* GetTransientWindowClient(); |
| 42 | 44 |
| 43 } // namespace client | 45 } // namespace client |
| 44 } // namespace aura | 46 } // namespace aura |
| 45 | 47 |
| 46 #endif // UI_WM_PUBLIC_TRANSIENT_WINDOW_CLIENT_H_ | 48 #endif // UI_AURA_CLIENT_TRANSIENT_WINDOW_CLIENT_H_ |
| OLD | NEW |