| Index: ash/wm/lock_window_state.cc
|
| diff --git a/ash/wm/lock_window_state.cc b/ash/wm/lock_window_state.cc
|
| index f2fc41586dd132a6a4868eed28403d6ebdce8b46..ef1aed18f8d24341df46f2f2bef1a2e1d5795ed4 100644
|
| --- a/ash/wm/lock_window_state.cc
|
| +++ b/ash/wm/lock_window_state.cc
|
| @@ -4,6 +4,7 @@
|
|
|
| #include "ash/wm/lock_window_state.h"
|
|
|
| +#include <memory>
|
| #include <utility>
|
|
|
| #include "ash/screen_util.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(aura::Window* window)
|
| - : current_state_type_(wm::GetWindowState(window)->GetStateType()) {}
|
| +LockWindowState::LockWindowState(aura::Window* window, bool exclude_shelf)
|
| + : current_state_type_(wm::GetWindowState(window)->GetStateType()),
|
| + exclude_shelf_(exclude_shelf) {}
|
|
|
| LockWindowState::~LockWindowState() {}
|
|
|
| @@ -105,7 +108,18 @@ void LockWindowState::DetachState(wm::WindowState* window_state) {}
|
| // static
|
| wm::WindowState* LockWindowState::SetLockWindowState(aura::Window* window) {
|
| std::unique_ptr<wm::WindowState::State> lock_state =
|
| - base::MakeUnique<LockWindowState>(window);
|
| + base::MakeUnique<LockWindowState>(window, false);
|
| + wm::WindowState* window_state = wm::GetWindowState(window);
|
| + std::unique_ptr<wm::WindowState::State> old_state(
|
| + window_state->SetStateObject(std::move(lock_state)));
|
| + return window_state;
|
| +}
|
| +
|
| +// static
|
| +wm::WindowState* LockWindowState::SetLockWindowStateWithShelfExcluded(
|
| + aura::Window* window) {
|
| + std::unique_ptr<wm::WindowState::State> lock_state =
|
| + base::MakeUnique<LockWindowState>(window, true);
|
| wm::WindowState* window_state = wm::GetWindowState(window);
|
| std::unique_ptr<wm::WindowState::State> old_state(
|
| window_state->SetStateObject(std::move(lock_state)));
|
| @@ -161,9 +175,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 (exclude_shelf_)
|
| + return ScreenUtil::GetDisplayWorkAreaBoundsInParentForLockScreen(window);
|
|
|
| keyboard::KeyboardController* keyboard_controller =
|
| keyboard::KeyboardController::GetInstance();
|
| @@ -173,10 +187,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());
|
| - 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());
|
| VLOG(1) << "Updating window bounds to: " << bounds.ToString();
|
| window_state->SetBoundsDirect(bounds);
|
| }
|
|
|