Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(598)

Side by Side Diff: ash/wm/window_util.h

Issue 1900443002: Removes aura dependencies from WindowPositioner (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nuke GetWorkAreaForWindowInParent and fix windows Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/wm/window_state.cc ('k') | ash/wm/window_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ASH_WM_WINDOW_UTIL_H_ 5 #ifndef ASH_WM_WINDOW_UTIL_H_
6 #define ASH_WM_WINDOW_UTIL_H_ 6 #define ASH_WM_WINDOW_UTIL_H_
7 7
8 #include "ash/ash_export.h" 8 #include "ash/ash_export.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "ui/base/ui_base_types.h" 10 #include "ui/base/ui_base_types.h"
11 11
12 namespace aura { 12 namespace aura {
13 class Window; 13 class Window;
14 } 14 }
15 15
16 namespace gfx { 16 namespace gfx {
17 class Point; 17 class Point;
18 class Rect; 18 class Rect;
19 class Size; 19 class Size;
20 } 20 }
21 21
22 namespace ui { 22 namespace ui {
23 class Event; 23 class Event;
24 } 24 }
25 25
26 namespace ash { 26 namespace ash {
27 // We force at least this many DIPs for any window on the screen.
28 const int kMinimumOnScreenArea = 25;
29
30 namespace wm { 27 namespace wm {
31 28
32 class WmWindow; 29 class WmWindow;
33 30
34 // Utility functions for window activation. 31 // Utility functions for window activation.
35 ASH_EXPORT void ActivateWindow(aura::Window* window); 32 ASH_EXPORT void ActivateWindow(aura::Window* window);
36 ASH_EXPORT void DeactivateWindow(aura::Window* window); 33 ASH_EXPORT void DeactivateWindow(aura::Window* window);
37 ASH_EXPORT bool IsActiveWindow(aura::Window* window); 34 ASH_EXPORT bool IsActiveWindow(aura::Window* window);
38 ASH_EXPORT aura::Window* GetActiveWindow(); 35 ASH_EXPORT aura::Window* GetActiveWindow();
39 ASH_EXPORT bool CanActivateWindow(aura::Window* window); 36 ASH_EXPORT bool CanActivateWindow(aura::Window* window);
(...skipping 22 matching lines...) Expand all
62 // Returns the bounds of a left snapped window with default width in parent 59 // Returns the bounds of a left snapped window with default width in parent
63 // coordinates. 60 // coordinates.
64 ASH_EXPORT gfx::Rect GetDefaultLeftSnappedWindowBoundsInParent( 61 ASH_EXPORT gfx::Rect GetDefaultLeftSnappedWindowBoundsInParent(
65 aura::Window* window); 62 aura::Window* window);
66 63
67 // Returns the bounds of a right snapped window with default width in parent 64 // Returns the bounds of a right snapped window with default width in parent
68 // coordinates. 65 // coordinates.
69 ASH_EXPORT gfx::Rect GetDefaultRightSnappedWindowBoundsInParent( 66 ASH_EXPORT gfx::Rect GetDefaultRightSnappedWindowBoundsInParent(
70 aura::Window* window); 67 aura::Window* window);
71 68
72 // Adjusts |bounds| so that the size does not exceed |max_size|.
73 ASH_EXPORT void AdjustBoundsSmallerThan(const gfx::Size& max_size,
74 gfx::Rect* bounds);
75
76 // Move the given bounds inside the given |visible_area| in parent coordinates,
77 // including a safety margin given by |kMinimumOnScreenArea|.
78 // This also ensures that the top of the bounds is visible.
79 ASH_EXPORT void AdjustBoundsToEnsureMinimumWindowVisibility(
80 const gfx::Rect& visible_area,
81 gfx::Rect* bounds);
82
83 // Move the given bounds inside the given |visible_area| in parent coordinates,
84 // including a safety margin given by |min_width| and |min_height|.
85 // This also ensures that the top of the bounds is visible.
86 ASH_EXPORT void AdjustBoundsToEnsureWindowVisibility(
87 const gfx::Rect& visible_area,
88 int min_width,
89 int min_height,
90 gfx::Rect* bounds);
91
92 // Moves |window| to the root window where the |event| occured if it is not 69 // Moves |window| to the root window where the |event| occured if it is not
93 // already in the same root window. Returns true if |window| was moved. 70 // already in the same root window. Returns true if |window| was moved.
94 ASH_EXPORT bool MoveWindowToEventRoot(aura::Window* window, 71 ASH_EXPORT bool MoveWindowToEventRoot(aura::Window* window,
95 const ui::Event& event); 72 const ui::Event& event);
96 73
97 // Changes the parent of a |child| and all its transient children that are 74 // Changes the parent of a |child| and all its transient children that are
98 // themselves children of |old_parent| to |new_parent|. 75 // themselves children of |old_parent| to |new_parent|.
99 void ReparentChildWithTransientChildren(aura::Window* child, 76 void ReparentChildWithTransientChildren(aura::Window* child,
100 aura::Window* old_parent, 77 aura::Window* old_parent,
101 aura::Window* new_parent); 78 aura::Window* new_parent);
(...skipping 13 matching lines...) Expand all
115 ASH_EXPORT void SetSnapsChildrenToPhysicalPixelBoundary( 92 ASH_EXPORT void SetSnapsChildrenToPhysicalPixelBoundary(
116 aura::Window* container); 93 aura::Window* container);
117 94
118 // Traverse the |container| tree and installs SnapToPixelLayoutManager. 95 // Traverse the |container| tree and installs SnapToPixelLayoutManager.
119 void InstallSnapLayoutManagerToContainers(aura::Window* container); 96 void InstallSnapLayoutManagerToContainers(aura::Window* container);
120 97
121 } // namespace wm 98 } // namespace wm
122 } // namespace ash 99 } // namespace ash
123 100
124 #endif // ASH_WM_WINDOW_UTIL_H_ 101 #endif // ASH_WM_WINDOW_UTIL_H_
OLDNEW
« no previous file with comments | « ash/wm/window_state.cc ('k') | ash/wm/window_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698