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_TREE_CLIENT_H_ 6 #define UI_AURA_CLIENT_WINDOW_TREE_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 WindowTreeClient { 21 public: 22 virtual ~WindowTreeClient() {} 23 24 // Called by the Window when it looks for a default parent. Returns the 25 // window that |window| should be added to instead. |context| provides a 26 // Window (generally a RootWindow) that can be used to determine which 27 // desktop type the default parent should be chosen from. NOTE: this may 28 // have side effects. It should only be used when |window| is going to be 29 // immediately added. 30 // 31 // TODO(erg): Remove |context|, and maybe after oshima's patch lands, 32 // |bounds|. 33 virtual Window* GetDefaultParent( 34 Window* context, 35 Window* window, 36 const gfx::Rect& bounds) = 0; 37 }; 38 39 // Set/Get a window tree client for the RootWindow containing |window|. |window| 40 // must not be NULL. 41 AURA_EXPORT void SetWindowTreeClient(Window* window, 42 WindowTreeClient* window_tree_client); 43 WindowTreeClient* GetWindowTreeClient(Window* window); 44 45 // Adds |window| to an appropriate parent by consulting an implementation of 46 // WindowTreeClient attached at the root Window containing |context|. The final 47 // location may be a window hierarchy other than the one supplied via 48 // |context|, which must not be NULL. |screen_bounds| may be empty. 49 AURA_EXPORT void ParentWindowWithContext(Window* window, 50 Window* context, 51 const gfx::Rect& screen_bounds); 52 53 } // namespace client 54 } // namespace aura 55 56 #endif // UI_AURA_CLIENT_WINDOW_TREE_CLIENT_H_ 57