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/window_sizer.h" | 5 #include "chrome/browser/ui/window_sizer/window_sizer.h" |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/wm/mru_window_tracker.h" | 9 #include "ash/wm/mru_window_tracker.h" |
| 10 #include "ash/wm/window_state.h" |
10 #include "ash/wm/window_util.h" | 11 #include "ash/wm/window_util.h" |
11 #include "ash/wm/workspace/auto_window_management.h" | 12 #include "ash/wm/workspace/auto_window_management.h" |
12 #include "base/command_line.h" | 13 #include "base/command_line.h" |
13 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
14 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
15 #include "chrome/browser/ui/browser_list.h" | 16 #include "chrome/browser/ui/browser_list.h" |
16 #include "chrome/browser/ui/browser_window.h" | 17 #include "chrome/browser/ui/browser_window.h" |
17 #include "ui/aura/root_window.h" | 18 #include "ui/aura/root_window.h" |
18 #include "ui/aura/window.h" | 19 #include "ui/aura/window.h" |
19 #include "ui/aura/window_delegate.h" | 20 #include "ui/aura/window_delegate.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 } | 129 } |
129 | 130 |
130 // When using "small screens" we want to always open in full screen mode. | 131 // When using "small screens" we want to always open in full screen mode. |
131 if (passed_show_state == ui::SHOW_STATE_DEFAULT && | 132 if (passed_show_state == ui::SHOW_STATE_DEFAULT && |
132 !browser_->is_session_restore() && | 133 !browser_->is_session_restore() && |
133 work_area.width() <= GetForceMaximizedWidthLimit() && | 134 work_area.width() <= GetForceMaximizedWidthLimit() && |
134 (!browser_->window() || !browser_->window()->IsFullscreen())) | 135 (!browser_->window() || !browser_->window()->IsFullscreen())) |
135 *show_state = ui::SHOW_STATE_MAXIMIZED; | 136 *show_state = ui::SHOW_STATE_MAXIMIZED; |
136 return; | 137 return; |
137 } | 138 } |
138 bool maximized = ash::wm::IsWindowMaximized(top_window); | 139 bool maximized = ash::wm::GetWindowState(top_window)->IsMaximized(); |
139 // We ignore the saved show state, but look instead for the top level | 140 // We ignore the saved show state, but look instead for the top level |
140 // window's show state. | 141 // window's show state. |
141 if (passed_show_state == ui::SHOW_STATE_DEFAULT) { | 142 if (passed_show_state == ui::SHOW_STATE_DEFAULT) { |
142 *show_state = maximized ? ui::SHOW_STATE_MAXIMIZED : | 143 *show_state = maximized ? ui::SHOW_STATE_MAXIMIZED : |
143 ui::SHOW_STATE_DEFAULT; | 144 ui::SHOW_STATE_DEFAULT; |
144 } | 145 } |
145 | 146 |
146 // Use the size of the other window. The window's bound will be rearranged | 147 // Use the size of the other window. The window's bound will be rearranged |
147 // in ash::WorkspaceLayoutManager using this location. | 148 // in ash::WorkspaceLayoutManager using this location. |
148 *bounds_in_screen = top_window->GetBoundsInScreen(); | 149 *bounds_in_screen = top_window->GetBoundsInScreen(); |
(...skipping 18 matching lines...) Expand all Loading... |
167 if (default_width > kMaximumWindowWidth) { | 168 if (default_width > kMaximumWindowWidth) { |
168 // The window should get centered on the screen and not follow the grid. | 169 // The window should get centered on the screen and not follow the grid. |
169 offset_x = (work_area.width() - kMaximumWindowWidth) / 2; | 170 offset_x = (work_area.width() - kMaximumWindowWidth) / 2; |
170 default_width = kMaximumWindowWidth; | 171 default_width = kMaximumWindowWidth; |
171 } | 172 } |
172 default_bounds->SetRect(work_area.x() + offset_x, | 173 default_bounds->SetRect(work_area.x() + offset_x, |
173 work_area.y() + kDesktopBorderSize, | 174 work_area.y() + kDesktopBorderSize, |
174 default_width, | 175 default_width, |
175 default_height); | 176 default_height); |
176 } | 177 } |
OLD | NEW |