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

Side by Side Diff: ash/common/wm/window_positioner.h

Issue 2766543002: Move even more from WmShell to Shell (Closed)
Patch Set: Created 3 years, 9 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/common/wm/window_cycle_list.cc ('k') | ash/common/wm/window_positioner.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_COMMON_WM_WINDOW_POSITIONER_H_ 5 #ifndef ASH_COMMON_WM_WINDOW_POSITIONER_H_
6 #define ASH_COMMON_WM_WINDOW_POSITIONER_H_ 6 #define ASH_COMMON_WM_WINDOW_POSITIONER_H_
7 7
8 #include "ash/ash_export.h" 8 #include "ash/ash_export.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "ui/base/ui_base_types.h" 10 #include "ui/base/ui_base_types.h"
11 11
12 namespace display { 12 namespace display {
13 class Display; 13 class Display;
14 } 14 }
15 15
16 namespace gfx { 16 namespace gfx {
17 class Rect; 17 class Rect;
18 } 18 }
19 19
20 namespace ash { 20 namespace ash {
21 21
22 class WmShell;
23 class WmWindow; 22 class WmWindow;
24 23
25 namespace test { 24 namespace test {
26 class WindowPositionerTest; 25 class WindowPositionerTest;
27 } 26 }
28 27
29 // WindowPositioner is used by the browser to move new popups automatically to 28 // WindowPositioner is used by the browser to move new popups automatically to
30 // a usable position on the closest work area (of the active window). 29 // a usable position on the closest work area (of the active window).
31 class ASH_EXPORT WindowPositioner { 30 class ASH_EXPORT WindowPositioner {
32 public: 31 public:
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 65
67 // Turn the automatic positioning logic temporarily off. Returns the previous 66 // Turn the automatic positioning logic temporarily off. Returns the previous
68 // state. 67 // state.
69 static bool DisableAutoPositioning(bool ignore); 68 static bool DisableAutoPositioning(bool ignore);
70 69
71 // Check if after insertion or showing of the given |added_window| 70 // Check if after insertion or showing of the given |added_window|
72 // an automated desktop location management can be performed and 71 // an automated desktop location management can be performed and
73 // rearrange accordingly. 72 // rearrange accordingly.
74 static void RearrangeVisibleWindowOnShow(WmWindow* added_window); 73 static void RearrangeVisibleWindowOnShow(WmWindow* added_window);
75 74
76 explicit WindowPositioner(WmShell* shell); 75 WindowPositioner();
77 ~WindowPositioner(); 76 ~WindowPositioner();
78 77
79 // Find a suitable screen position for a popup window and return it. The 78 // Find a suitable screen position for a popup window and return it. The
80 // passed input position is only used to retrieve the width and height. 79 // passed input position is only used to retrieve the width and height.
81 // The position is determined on the left / right / top / bottom first. If 80 // The position is determined on the left / right / top / bottom first. If
82 // no smart space is found, the position will follow the standard what other 81 // no smart space is found, the position will follow the standard what other
83 // operating systems do (default cascading style). 82 // operating systems do (default cascading style).
84 gfx::Rect GetPopupPosition(const gfx::Rect& old_pos); 83 gfx::Rect GetPopupPosition(const gfx::Rect& old_pos);
85 84
86 // Accessor to set a flag indicating whether the first window in ASH should 85 // Accessor to set a flag indicating whether the first window in ASH should
(...skipping 14 matching lines...) Expand all
101 const gfx::Rect& work_area); 100 const gfx::Rect& work_area);
102 101
103 // Align the location to the grid / snap to the right / bottom corner. 102 // Align the location to the grid / snap to the right / bottom corner.
104 gfx::Rect AlignPopupPosition(const gfx::Rect& pos, 103 gfx::Rect AlignPopupPosition(const gfx::Rect& pos,
105 const gfx::Rect& work_area, 104 const gfx::Rect& work_area,
106 int grid); 105 int grid);
107 106
108 // Constant exposed for unittest. 107 // Constant exposed for unittest.
109 static const int kMinimumWindowOffset; 108 static const int kMinimumWindowOffset;
110 109
111 WmShell* shell_;
112
113 // The offset in X and Y for the next popup which opens. 110 // The offset in X and Y for the next popup which opens.
114 int pop_position_offset_increment_x; 111 int pop_position_offset_increment_x;
115 int pop_position_offset_increment_y; 112 int pop_position_offset_increment_y;
116 113
117 // The position on the screen for the first popup which gets shown if no 114 // The position on the screen for the first popup which gets shown if no
118 // empty space can be found. 115 // empty space can be found.
119 int popup_position_offset_from_screen_corner_x; 116 int popup_position_offset_from_screen_corner_x;
120 int popup_position_offset_from_screen_corner_y; 117 int popup_position_offset_from_screen_corner_y;
121 118
122 // The last used position. 119 // The last used position.
123 int last_popup_position_x_; 120 int last_popup_position_x_;
124 int last_popup_position_y_; 121 int last_popup_position_y_;
125 122
126 DISALLOW_COPY_AND_ASSIGN(WindowPositioner); 123 DISALLOW_COPY_AND_ASSIGN(WindowPositioner);
127 }; 124 };
128 125
129 } // namespace ash 126 } // namespace ash
130 127
131 #endif // ASH_COMMON_WM_WINDOW_POSITIONER_H_ 128 #endif // ASH_COMMON_WM_WINDOW_POSITIONER_H_
OLDNEW
« no previous file with comments | « ash/common/wm/window_cycle_list.cc ('k') | ash/common/wm/window_positioner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698