window_parenting_client.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Copyright (c) 2013 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_WINDOW_PARENTING_CLIENT_H_
  5. #define UI_AURA_CLIENT_WINDOW_PARENTING_CLIENT_H_
  6. #include "ui/aura/aura_export.h"
  7. namespace gfx {
  8. class Rect;
  9. }
  10. namespace aura {
  11. class Window;
  12. namespace client {
  13. // Implementations of this object are used to help locate a default parent for
  14. // NULL-parented Windows.
  15. class AURA_EXPORT WindowParentingClient {
  16. public:
  17. virtual ~WindowParentingClient() {}
  18. // Called by the Window when it looks for a default parent. Returns the
  19. // window that |window| should be added to instead. NOTE: this may have
  20. // side effects. It should only be used when |window| is going to be
  21. // immediately added.
  22. virtual Window* GetDefaultParent(Window* window, const gfx::Rect& bounds) = 0;
  23. };
  24. // Set/Get a window tree client for the RootWindow containing |window|. |window|
  25. // must not be NULL.
  26. AURA_EXPORT void SetWindowParentingClient(
  27. Window* window,
  28. WindowParentingClient* window_tree_client);
  29. AURA_EXPORT WindowParentingClient* GetWindowParentingClient(Window* window);
  30. // Adds |window| to an appropriate parent by consulting an implementation of
  31. // WindowParentingClient attached at the root Window containing |context|. The
  32. // final
  33. // location may be a window hierarchy other than the one supplied via
  34. // |context|, which must not be NULL. |screen_bounds| may be empty.
  35. AURA_EXPORT void ParentWindowWithContext(Window* window,
  36. Window* context,
  37. const gfx::Rect& screen_bounds);
  38. } // namespace client
  39. } // namespace aura
  40. #endif // UI_AURA_CLIENT_WINDOW_PARENTING_CLIENT_H_