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