| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/aura/wm_window_aura.h" | 9 #include "ash/aura/wm_window_aura.h" |
| 10 #include "ash/common/wm/window_animation_types.h" | 10 #include "ash/common/wm/window_animation_types.h" |
| 11 #include "ash/common/wm/window_state.h" | 11 #include "ash/common/wm/window_state.h" |
| 12 #include "ash/common/wm/window_state_delegate.h" | 12 #include "ash/common/wm/window_state_delegate.h" |
| 13 #include "ash/common/wm/window_state_util.h" | 13 #include "ash/common/wm/window_state_util.h" |
| 14 #include "ash/common/wm/wm_event.h" | 14 #include "ash/common/wm/wm_event.h" |
| 15 #include "ash/common/wm/wm_screen_util.h" |
| 16 #include "ash/common/wm_shell.h" |
| 15 #include "ash/display/display_manager.h" | 17 #include "ash/display/display_manager.h" |
| 16 #include "ash/screen_util.h" | |
| 17 #include "ash/shell.h" | 18 #include "ash/shell.h" |
| 18 #include "ash/wm/lock_layout_manager.h" | 19 #include "ash/wm/lock_layout_manager.h" |
| 19 #include "ash/wm/window_animations.h" | 20 #include "ash/wm/window_animations.h" |
| 20 #include "ash/wm/window_state_aura.h" | 21 #include "ash/wm/window_state_aura.h" |
| 21 #include "ash/wm/window_util.h" | 22 #include "ash/wm/window_util.h" |
| 22 #include "ui/aura/window.h" | 23 #include "ui/aura/window.h" |
| 23 #include "ui/aura/window_delegate.h" | 24 #include "ui/aura/window_delegate.h" |
| 24 #include "ui/gfx/geometry/rect.h" | 25 #include "ui/gfx/geometry/rect.h" |
| 25 #include "ui/keyboard/keyboard_controller.h" | 26 #include "ui/keyboard/keyboard_controller.h" |
| 26 #include "ui/keyboard/keyboard_util.h" | 27 #include "ui/keyboard/keyboard_util.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 } | 162 } |
| 162 } | 163 } |
| 163 | 164 |
| 164 wm::WindowStateType LockWindowState::GetMaximizedOrCenteredWindowType( | 165 wm::WindowStateType LockWindowState::GetMaximizedOrCenteredWindowType( |
| 165 wm::WindowState* window_state) { | 166 wm::WindowState* window_state) { |
| 166 return window_state->CanMaximize() ? wm::WINDOW_STATE_TYPE_MAXIMIZED | 167 return window_state->CanMaximize() ? wm::WINDOW_STATE_TYPE_MAXIMIZED |
| 167 : wm::WINDOW_STATE_TYPE_NORMAL; | 168 : wm::WINDOW_STATE_TYPE_NORMAL; |
| 168 } | 169 } |
| 169 | 170 |
| 170 gfx::Rect GetBoundsForLockWindow(aura::Window* window) { | 171 gfx::Rect GetBoundsForLockWindow(aura::Window* window) { |
| 171 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 172 if (WmShell::Get()->IsInUnifiedMode()) |
| 172 if (display_manager->IsInUnifiedMode()) { | 173 return WmShell::Get()->GetFirstDisplay().bounds(); |
| 173 const display::Display& first = | 174 return wm::GetDisplayBoundsInParent(WmWindowAura::Get(window)); |
| 174 display_manager->software_mirroring_display_list()[0]; | |
| 175 return first.bounds(); | |
| 176 } else { | |
| 177 return ScreenUtil::GetDisplayBoundsInParent(window); | |
| 178 } | |
| 179 } | 175 } |
| 180 | 176 |
| 181 void LockWindowState::UpdateBounds(wm::WindowState* window_state) { | 177 void LockWindowState::UpdateBounds(wm::WindowState* window_state) { |
| 182 if (!window_state->IsMaximized() && !window_state->IsFullscreen()) | 178 if (!window_state->IsMaximized() && !window_state->IsFullscreen()) |
| 183 return; | 179 return; |
| 184 | 180 |
| 185 keyboard::KeyboardController* keyboard_controller = | 181 keyboard::KeyboardController* keyboard_controller = |
| 186 keyboard::KeyboardController::GetInstance(); | 182 keyboard::KeyboardController::GetInstance(); |
| 187 gfx::Rect keyboard_bounds; | 183 gfx::Rect keyboard_bounds; |
| 188 | 184 |
| 189 if (keyboard_controller && !keyboard::IsKeyboardOverscrollEnabled() && | 185 if (keyboard_controller && !keyboard::IsKeyboardOverscrollEnabled() && |
| 190 keyboard_controller->keyboard_visible()) { | 186 keyboard_controller->keyboard_visible()) { |
| 191 keyboard_bounds = keyboard_controller->current_keyboard_bounds(); | 187 keyboard_bounds = keyboard_controller->current_keyboard_bounds(); |
| 192 } | 188 } |
| 193 gfx::Rect bounds = ScreenUtil::GetShelfDisplayBoundsInRoot( | 189 gfx::Rect bounds = wm::GetDisplayBoundsWithShelf(window_state->window()); |
| 194 ash::WmWindowAura::GetAuraWindow(window_state->window())); | |
| 195 | |
| 196 bounds.set_height(bounds.height() - keyboard_bounds.height()); | 190 bounds.set_height(bounds.height() - keyboard_bounds.height()); |
| 197 | 191 |
| 198 VLOG(1) << "Updating window bounds to: " << bounds.ToString(); | 192 VLOG(1) << "Updating window bounds to: " << bounds.ToString(); |
| 199 window_state->SetBoundsDirect(bounds); | 193 window_state->SetBoundsDirect(bounds); |
| 200 } | 194 } |
| 201 | 195 |
| 202 } // namespace ash | 196 } // namespace ash |
| OLD | NEW |