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.
5 #ifndef UI_WM_CORE_WINDOW_UTIL_H_
6 #define UI_WM_CORE_WINDOW_UTIL_H_
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"
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
);
32 // Retrieves the activatable window for |window|. The ActivationClient makes
33 // this determination.
34 WM_EXPORT
aura::Window
* GetActivatableWindow(aura::Window
* window
);
36 // Retrieves the toplevel window for |window|. The ActivationClient makes this
38 WM_EXPORT
aura::Window
* GetToplevelWindow(aura::Window
* window
);
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.
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
);
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
);
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
);
67 #endif // UI_WM_CORE_WINDOW_UTIL_H_