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 ASH_WM_WINDOW_UTIL_H_
6 #define ASH_WM_WINDOW_UTIL_H_
8 #include "ash/ash_export.h"
9 #include "base/compiler_specific.h"
10 #include "ui/base/ui_base_types.h"
25 // We force at least this many DIPs for any window on the screen.
26 const int kMinimumOnScreenArea
= 10;
30 // Utility functions for window activation.
31 ASH_EXPORT
void ActivateWindow(aura::Window
* window
);
32 ASH_EXPORT
void DeactivateWindow(aura::Window
* window
);
33 ASH_EXPORT
bool IsActiveWindow(aura::Window
* window
);
34 ASH_EXPORT
aura::Window
* GetActiveWindow();
35 ASH_EXPORT
bool CanActivateWindow(aura::Window
* window
);
37 // Retrieves the activatable window for |window|. If |window| is activatable,
38 // this will just return it, otherwise it will climb the parent/transient parent
39 // chain looking for a window that is activatable, per the ActivationController.
40 // If you're looking for a function to get the activatable "top level" window,
41 // this is probably what you're looking for.
42 ASH_EXPORT
aura::Window
* GetActivatableWindow(aura::Window
* window
);
44 // TODO(oshima): remove this.
45 ASH_EXPORT
bool IsWindowMinimized(aura::Window
* window
);
47 // Moves the window to the center of the display.
48 ASH_EXPORT
void CenterWindow(aura::Window
* window
);
50 // Change the availability of animation to the fullscreen of the |window|.
51 ASH_EXPORT
void SetAnimateToFullscreen(aura::Window
* window
, bool animate
);
53 // Move the given bounds inside the given |visible_area|, including a
54 // safety margin given by |kMinimumOnScreenArea|.
55 ASH_EXPORT
void AdjustBoundsToEnsureMinimumWindowVisibility(
56 const gfx::Rect
& visible_area
,
59 // Move the given bounds inside the given |visible_area|, including a
60 // safety margin given by |min_width| and |min_height|.
61 ASH_EXPORT
void AdjustBoundsToEnsureWindowVisibility(
62 const gfx::Rect
& visible_area
,
67 // Moves |window| to the root window where the |event| occured if it is not
68 // already in the same root window. Returns true if |window| was moved.
69 ASH_EXPORT
bool MoveWindowToEventRoot(aura::Window
* window
,
70 const ui::Event
& event
);
75 #endif // ASH_WM_WINDOW_UTIL_H_