OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ash/wm/lock_window_state.h" | 5 #include "ash/wm/lock_window_state.h" |
6 | 6 |
| 7 #include "ash/display/display_manager.h" |
7 #include "ash/screen_util.h" | 8 #include "ash/screen_util.h" |
8 #include "ash/shell.h" | 9 #include "ash/shell.h" |
9 #include "ash/wm/lock_layout_manager.h" | 10 #include "ash/wm/lock_layout_manager.h" |
10 #include "ash/wm/window_animations.h" | 11 #include "ash/wm/window_animations.h" |
11 #include "ash/wm/window_state.h" | 12 #include "ash/wm/window_state.h" |
12 #include "ash/wm/window_state_delegate.h" | 13 #include "ash/wm/window_state_delegate.h" |
13 #include "ash/wm/window_state_util.h" | 14 #include "ash/wm/window_state_util.h" |
14 #include "ash/wm/window_util.h" | 15 #include "ash/wm/window_util.h" |
15 #include "ash/wm/wm_event.h" | 16 #include "ash/wm/wm_event.h" |
16 #include "ui/aura/window.h" | 17 #include "ui/aura/window.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 window_state->window()->Show(); | 158 window_state->window()->Show(); |
158 } | 159 } |
159 } | 160 } |
160 | 161 |
161 wm::WindowStateType LockWindowState::GetMaximizedOrCenteredWindowType( | 162 wm::WindowStateType LockWindowState::GetMaximizedOrCenteredWindowType( |
162 wm::WindowState* window_state) { | 163 wm::WindowState* window_state) { |
163 return window_state->CanMaximize() ? wm::WINDOW_STATE_TYPE_MAXIMIZED : | 164 return window_state->CanMaximize() ? wm::WINDOW_STATE_TYPE_MAXIMIZED : |
164 wm::WINDOW_STATE_TYPE_NORMAL; | 165 wm::WINDOW_STATE_TYPE_NORMAL; |
165 } | 166 } |
166 | 167 |
| 168 gfx::Rect GetBoundsForLockWindow(aura::Window* window) { |
| 169 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
| 170 if (display_manager->IsInUnifiedMode()) { |
| 171 const gfx::Display& first = |
| 172 display_manager->software_mirroring_display_list()[0]; |
| 173 return first.bounds(); |
| 174 } else { |
| 175 return ScreenUtil::GetDisplayBoundsInParent(window); |
| 176 } |
| 177 } |
| 178 |
167 void LockWindowState::UpdateBounds(wm::WindowState* window_state) { | 179 void LockWindowState::UpdateBounds(wm::WindowState* window_state) { |
168 if (!window_state->IsMaximized() && !window_state->IsFullscreen()) | 180 if (!window_state->IsMaximized() && !window_state->IsFullscreen()) |
169 return; | 181 return; |
170 | 182 |
171 keyboard::KeyboardController* keyboard_controller = | 183 keyboard::KeyboardController* keyboard_controller = |
172 keyboard::KeyboardController::GetInstance(); | 184 keyboard::KeyboardController::GetInstance(); |
173 gfx::Rect keyboard_bounds; | 185 gfx::Rect keyboard_bounds; |
174 | 186 |
175 if (keyboard_controller && | 187 if (keyboard_controller && |
176 !keyboard::IsKeyboardOverscrollEnabled() && | 188 !keyboard::IsKeyboardOverscrollEnabled() && |
177 keyboard_controller->keyboard_visible()) { | 189 keyboard_controller->keyboard_visible()) { |
178 keyboard_bounds = keyboard_controller->current_keyboard_bounds(); | 190 keyboard_bounds = keyboard_controller->current_keyboard_bounds(); |
179 } | 191 } |
| 192 gfx::Rect bounds = |
| 193 ScreenUtil::GetShelfDisplayBoundsInScreen(window_state->window()); |
180 | 194 |
181 gfx::Rect bounds = | |
182 ScreenUtil::GetDisplayBoundsInParent(window_state->window()); | |
183 bounds.set_height(bounds.height() - keyboard_bounds.height()); | 195 bounds.set_height(bounds.height() - keyboard_bounds.height()); |
184 | 196 |
185 VLOG(1) << "Updating window bounds to: " << bounds.ToString(); | 197 VLOG(1) << "Updating window bounds to: " << bounds.ToString(); |
186 window_state->SetBoundsDirect(bounds); | 198 window_state->SetBoundsDirect(bounds); |
187 } | 199 } |
188 | 200 |
189 } // namespace ash | 201 } // namespace ash |
OLD | NEW |