transient_window_client.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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
  3. // found in the LICENSE file.
  4. #ifndef UI_AURA_CLIENT_TRANSIENT_WINDOW_CLIENT_H_
  5. #define UI_AURA_CLIENT_TRANSIENT_WINDOW_CLIENT_H_
  6. #include <vector>
  7. #include "ui/aura/aura_export.h"
  8. namespace aura {
  9. class Window;
  10. namespace client {
  11. class TransientWindowClientObserver;
  12. // TransientWindowClient is used to add or remove transient windows. Transient
  13. // children get the following behavior:
  14. // . The transient parent destroys any transient children when it is
  15. // destroyed. This means a transient child is destroyed if either its parent
  16. // or transient parent is destroyed.
  17. // . If a transient child and its transient parent share the same parent, then
  18. // transient children are always ordered above the transient parent.
  19. // Transient windows are typically used for popups and menus.
  20. class AURA_EXPORT TransientWindowClient {
  21. public:
  22. virtual void AddTransientChild(Window* parent, Window* child) = 0;
  23. virtual void RemoveTransientChild(Window* parent, Window* child) = 0;
  24. virtual Window* GetTransientParent(Window* window) = 0;
  25. virtual const Window* GetTransientParent(const Window* window) = 0;
  26. virtual std::vector<Window*> GetTransientChildren(const Window* parent) = 0;
  27. virtual void AddObserver(TransientWindowClientObserver* observer) = 0;
  28. virtual void RemoveObserver(TransientWindowClientObserver* observer) = 0;
  29. protected:
  30. virtual ~TransientWindowClient() {}
  31. };
  32. // Sets/gets the TransientWindowClient. This does *not* take ownership of
  33. // |client|. It is assumed the caller will invoke SetTransientWindowClient(NULL)
  34. // before deleting |client|.
  35. AURA_EXPORT void SetTransientWindowClient(TransientWindowClient* client);
  36. AURA_EXPORT TransientWindowClient* GetTransientWindowClient();
  37. } // namespace client
  38. } // namespace aura
  39. #endif // UI_AURA_CLIENT_TRANSIENT_WINDOW_CLIENT_H_