OLD | NEW |
---|---|
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 #include "chrome/browser/ui/window_sizer.h" | 5 #include "chrome/browser/ui/window_sizer.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/wm/window_cycle_controller.h" | 8 #include "ash/wm/window_cycle_controller.h" |
9 #include "ash/wm/window_util.h" | 9 #include "ash/wm/window_util.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
111 gfx::Rect work_area = monitor_info_provider_->GetPrimaryMonitorWorkArea(); | 111 gfx::Rect work_area = monitor_info_provider_->GetPrimaryMonitorWorkArea(); |
112 | 112 |
113 DCHECK_EQ(kDesktopBorderSize, ash::Shell::GetInstance()->GetGridSize()); | 113 DCHECK_EQ(kDesktopBorderSize, ash::Shell::GetInstance()->GetGridSize()); |
114 | 114 |
115 // There should be a 'desktop' border around the window at the left and right | 115 // There should be a 'desktop' border around the window at the left and right |
116 // side. | 116 // side. |
117 int default_width = work_area.width() - 2 * kDesktopBorderSize; | 117 int default_width = work_area.width() - 2 * kDesktopBorderSize; |
118 // There should also be a 'desktop' border around the window at the top. | 118 // There should also be a 'desktop' border around the window at the top. |
119 // Since the workspace excludes the tray area we only need one border size. | 119 // Since the workspace excludes the tray area we only need one border size. |
120 int default_height = work_area.height() - kDesktopBorderSize; | 120 int default_height = work_area.height() - kDesktopBorderSize; |
121 // We align the size to the grid size to avoid any surprise when the | |
122 // monitor height isn't divide-able by our alignment factor. | |
123 default_width -= default_width % kDesktopBorderSize; | |
124 default_height -= default_height % kDesktopBorderSize; | |
121 int offset_x = kDesktopBorderSize; | 125 int offset_x = kDesktopBorderSize; |
122 int maximum_window_width = 1280; | 126 int maximum_window_width = 1280; |
123 if (default_width > maximum_window_width) { | 127 if (default_width > maximum_window_width) { |
124 // The window should get centered on the screen as well. | 128 // The window should get centered on the screen as well. |
129 // Note: It is highly unlikely but not impossible that this will bring the | |
sky
2012/04/13 19:44:02
This could happen if the launcher is aligned to th
Mr4D (OOO till 08-26)
2012/04/13 20:47:39
Okay, changed the comment.
| |
130 // window into an unaligned X position. However - in this case we'd rather | |
131 // want the window to be centered. | |
125 offset_x = (work_area.width() - maximum_window_width) / 2; | 132 offset_x = (work_area.width() - maximum_window_width) / 2; |
126 // Never make a window wider then 1280. | 133 // Never make a window wider then 1280. |
127 default_width = maximum_window_width; | 134 default_width = maximum_window_width; |
128 } | 135 } |
129 default_bounds->SetRect(work_area.x() + offset_x, | 136 default_bounds->SetRect(work_area.x() + offset_x, |
130 work_area.y() + kDesktopBorderSize, | 137 work_area.y() + kDesktopBorderSize, |
131 default_width, | 138 default_width, |
132 default_height); | 139 default_height); |
133 } | 140 } |
OLD | NEW |