| Index: ash/wm/lock_window_state.cc
|
| diff --git a/ash/wm/lock_window_state.cc b/ash/wm/lock_window_state.cc
|
| index 182e550ea34db94a7d1175740939d1fcf2e0def4..aa3a3a6ae7cb84c7e3bfdc06d1f723d0a72b4a49 100644
|
| --- a/ash/wm/lock_window_state.cc
|
| +++ b/ash/wm/lock_window_state.cc
|
| @@ -7,6 +7,7 @@
|
| #include <utility>
|
|
|
| #include "ash/screen_util.h"
|
| +#include "ash/shelf/wm_shelf.h"
|
| #include "ash/wm/lock_layout_manager.h"
|
| #include "ash/wm/window_animation_types.h"
|
| #include "ash/wm/window_state.h"
|
| @@ -18,11 +19,13 @@
|
| #include "ui/gfx/geometry/rect.h"
|
| #include "ui/keyboard/keyboard_controller.h"
|
| #include "ui/keyboard/keyboard_util.h"
|
| +#include "ui/wm/core/coordinate_conversion.h"
|
|
|
| namespace ash {
|
|
|
| -LockWindowState::LockWindowState(WmWindow* window)
|
| - : current_state_type_(window->GetWindowState()->GetStateType()) {}
|
| +LockWindowState::LockWindowState(WmWindow* window, bool shelf_visible)
|
| + : current_state_type_(window->GetWindowState()->GetStateType()),
|
| + shelf_visible_(shelf_visible) {}
|
|
|
| LockWindowState::~LockWindowState() {}
|
|
|
| @@ -105,7 +108,17 @@ void LockWindowState::DetachState(wm::WindowState* window_state) {}
|
| // static
|
| wm::WindowState* LockWindowState::SetLockWindowState(WmWindow* window) {
|
| std::unique_ptr<wm::WindowState::State> lock_state =
|
| - base::MakeUnique<LockWindowState>(window);
|
| + base::MakeUnique<LockWindowState>(window, false);
|
| + std::unique_ptr<wm::WindowState::State> old_state(
|
| + window->GetWindowState()->SetStateObject(std::move(lock_state)));
|
| + return window->GetWindowState();
|
| +}
|
| +
|
| +// static
|
| +wm::WindowState* LockWindowState::SetLockWindowStateWithVisibleShelf(
|
| + WmWindow* window) {
|
| + std::unique_ptr<wm::WindowState::State> lock_state =
|
| + base::MakeUnique<LockWindowState>(window, true);
|
| std::unique_ptr<wm::WindowState::State> old_state(
|
| window->GetWindowState()->SetStateObject(std::move(lock_state)));
|
| return window->GetWindowState();
|
| @@ -160,9 +173,9 @@ wm::WindowStateType LockWindowState::GetMaximizedOrCenteredWindowType(
|
| : wm::WINDOW_STATE_TYPE_NORMAL;
|
| }
|
|
|
| -void LockWindowState::UpdateBounds(wm::WindowState* window_state) {
|
| - if (!window_state->IsMaximized() && !window_state->IsFullscreen())
|
| - return;
|
| +gfx::Rect LockWindowState::GetWindowBounds(aura::Window* window) {
|
| + if (shelf_visible_)
|
| + return ScreenUtil::GetDisplayWorkAreaBoundsInParentForLockScreen(window);
|
|
|
| keyboard::KeyboardController* keyboard_controller =
|
| keyboard::KeyboardController::GetInstance();
|
| @@ -172,10 +185,17 @@ void LockWindowState::UpdateBounds(wm::WindowState* window_state) {
|
| keyboard_controller->keyboard_visible()) {
|
| keyboard_bounds = keyboard_controller->current_keyboard_bounds();
|
| }
|
| - gfx::Rect bounds = ScreenUtil::GetDisplayBoundsWithShelf(
|
| - window_state->window()->aura_window());
|
| - bounds.set_height(bounds.height() - keyboard_bounds.height());
|
|
|
| + gfx::Rect bounds = ScreenUtil::GetDisplayBoundsWithShelf(window);
|
| + bounds.Inset(0, 0, 0, keyboard_bounds.height());
|
| + return bounds;
|
| +}
|
| +
|
| +void LockWindowState::UpdateBounds(wm::WindowState* window_state) {
|
| + if (!window_state->IsMaximized() && !window_state->IsFullscreen())
|
| + return;
|
| +
|
| + gfx::Rect bounds = GetWindowBounds(window_state->window()->aura_window());
|
| VLOG(1) << "Updating window bounds to: " << bounds.ToString();
|
| window_state->SetBoundsDirect(bounds);
|
| }
|
|
|