1 // Copyright (c) 2012 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_WM_CORE_WINDOW_UTIL_H_ 6 #define UI_WM_CORE_WINDOW_UTIL_H_ 7 8 #include <vector> 9 10 #include "base/basictypes.h" 11 #include "base/compiler_specific.h" 12 #include "base/memory/scoped_ptr.h" 13 #include "ui/wm/wm_export.h" 14 15 namespace aura { 16 class Window; 17 } 18 19 namespace ui { 20 class Layer; 21 class LayerOwner; 22 class LayerTreeOwner; 23 } 24 25 namespace wm { 26 27 WM_EXPORT void ActivateWindow(aura::Window* window); 28 WM_EXPORT void DeactivateWindow(aura::Window* window); 29 WM_EXPORT bool IsActiveWindow(aura::Window* window); 30 WM_EXPORT bool CanActivateWindow(aura::Window* window); 31 32 // Retrieves the activatable window for |window|. The ActivationClient makes 33 // this determination. 34 WM_EXPORT aura::Window* GetActivatableWindow(aura::Window* window); 35 36 // Retrieves the toplevel window for |window|. The ActivationClient makes this 37 // determination. 38 WM_EXPORT aura::Window* GetToplevelWindow(aura::Window* window); 39 40 // Returns the existing Layer for |root| (and all its descendants) and creates 41 // a new layer for |root| and all its descendants. This is intended for 42 // animations that want to animate between the existing visuals and a new state. 43 // 44 // As a result of this |root| has freshly created layers, meaning the layers 45 // have not yet been painted to. 46 WM_EXPORT scoped_ptr<ui::LayerTreeOwner> RecreateLayers( 47 ui::LayerOwner* root); 48 49 // Convenience functions that get the TransientWindowManager for the window and 50 // redirect appropriately. These are preferable to calling functions on 51 // TransientWindowManager as they handle the appropriate NULL checks. 52 WM_EXPORT aura::Window* GetTransientParent(aura::Window* window); 53 WM_EXPORT const aura::Window* GetTransientParent( 54 const aura::Window* window); 55 WM_EXPORT const std::vector<aura::Window*>& GetTransientChildren( 56 const aura::Window* window); 57 WM_EXPORT void AddTransientChild(aura::Window* parent, aura::Window* child); 58 WM_EXPORT void RemoveTransientChild(aura::Window* parent, aura::Window* child); 59 60 // Returns true if |window| has |ancestor| as a transient ancestor. A transient 61 // ancestor is found by following the transient parent chain of the window. 62 WM_EXPORT bool HasTransientAncestor(const aura::Window* window, 63 const aura::Window* ancestor); 64 65 } // namespace wm 66 67 #endif // UI_WM_CORE_WINDOW_UTIL_H_ 68