146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved.
246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)// found in the LICENSE file.
446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)#include "ash/wm/lock_window_state.h"
646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)#include "ash/screen_util.h"
846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)#include "ash/shell.h"
946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)#include "ash/wm/lock_layout_manager.h"
1046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)#include "ash/wm/window_animations.h"
1146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)#include "ash/wm/window_state.h"
1246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)#include "ash/wm/window_state_delegate.h"
1346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)#include "ash/wm/window_state_util.h"
1446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)#include "ash/wm/window_util.h"
1546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)#include "ash/wm/wm_event.h"
1646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)#include "ui/aura/window.h"
1746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)#include "ui/aura/window_delegate.h"
1846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)#include "ui/gfx/rect.h"
1946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)#include "ui/keyboard/keyboard_controller.h"
2046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)#include "ui/keyboard/keyboard_util.h"
2146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)#include "ui/wm/core/window_animations.h"
2246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
2346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)namespace ash {
2446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
2546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)LockWindowState::LockWindowState(aura::Window* window)
2646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    : current_state_type_(wm::GetWindowState(window)->GetStateType()) {
2746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)}
2846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
2946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)LockWindowState::~LockWindowState() {
3046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)}
3146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
3246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)void LockWindowState::OnWMEvent(wm::WindowState* window_state,
3346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)                                const wm::WMEvent* event) {
3446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  aura::Window* window = window_state->window();
3546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  gfx::Rect bounds = window->bounds();
3646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
3746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  switch (event->type()) {
3846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    case wm::WM_EVENT_TOGGLE_FULLSCREEN:
3946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)      ToggleFullScreen(window_state, window_state->delegate());
4046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)      break;
4146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    case wm::WM_EVENT_FULLSCREEN:
4246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)      UpdateWindow(window_state, wm::WINDOW_STATE_TYPE_FULLSCREEN);
4346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)      break;
4446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    case wm::WM_EVENT_TOGGLE_MAXIMIZE_CAPTION:
4546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    case wm::WM_EVENT_TOGGLE_VERTICAL_MAXIMIZE:
4646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    case wm::WM_EVENT_TOGGLE_HORIZONTAL_MAXIMIZE:
4746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    case wm::WM_EVENT_TOGGLE_MAXIMIZE:
4846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    case wm::WM_EVENT_CENTER:
4946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    case wm::WM_EVENT_SNAP_LEFT:
5046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    case wm::WM_EVENT_SNAP_RIGHT:
5146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    case wm::WM_EVENT_NORMAL:
5246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    case wm::WM_EVENT_MAXIMIZE:
5346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)      UpdateWindow(window_state,
5446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)                   GetMaximizedOrCenteredWindowType(window_state));
5546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)      return;
5646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    case wm::WM_EVENT_MINIMIZE:
5746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)      UpdateWindow(window_state, wm::WINDOW_STATE_TYPE_MINIMIZED);
5846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)      return;
5946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    case wm::WM_EVENT_SHOW_INACTIVE:
6046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)      return;
6146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    case wm::WM_EVENT_SET_BOUNDS:
626d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)      if (window_state->IsMaximized() || window_state->IsFullscreen()) {
636d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)        UpdateBounds(window_state);
646d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)      } else {
656d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)        const ash::wm::SetBoundsEvent* bounds_event =
666d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)            static_cast<const ash::wm::SetBoundsEvent*>(event);
676d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)        window_state->SetBoundsConstrained(bounds_event->requested_bounds());
686d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)      }
6946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)      break;
7046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    case wm::WM_EVENT_ADDED_TO_WORKSPACE:
7146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)      if (current_state_type_ != wm::WINDOW_STATE_TYPE_MAXIMIZED &&
7246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)          current_state_type_ != wm::WINDOW_STATE_TYPE_MINIMIZED &&
7346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)          current_state_type_ != wm::WINDOW_STATE_TYPE_FULLSCREEN) {
7446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)        UpdateWindow(window_state,
7546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)                     GetMaximizedOrCenteredWindowType(window_state));
7646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)      }
7746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)      break;
7846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    case wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED:
7946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    case wm::WM_EVENT_DISPLAY_BOUNDS_CHANGED:
8046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)      UpdateBounds(window_state);
8146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)      break;
8246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  }
8346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)}
8446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
8546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)wm::WindowStateType LockWindowState::GetType() const {
8646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  return current_state_type_;
8746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)}
8846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
8946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)void LockWindowState::AttachState(wm::WindowState* window_state,
9046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)                                  wm::WindowState::State* previous_state) {
9146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  current_state_type_ = previous_state->GetType();
9246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
9346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // Initialize the state to a good preset.
9446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  if (current_state_type_ != wm::WINDOW_STATE_TYPE_MAXIMIZED &&
9546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)      current_state_type_ != wm::WINDOW_STATE_TYPE_MINIMIZED &&
9646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)      current_state_type_ != wm::WINDOW_STATE_TYPE_FULLSCREEN) {
9746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    UpdateWindow(window_state,
9846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)                 GetMaximizedOrCenteredWindowType(window_state));
9946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  }
10046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)}
10146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
10246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)void LockWindowState::DetachState(wm::WindowState* window_state) {
10346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)}
10446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
10546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)// static
10646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)wm::WindowState* LockWindowState::SetLockWindowState(aura::Window* window) {
10746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  scoped_ptr<wm::WindowState::State> lock_state(new LockWindowState(window));
10846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  scoped_ptr<wm::WindowState::State> old_state(
10946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)      wm::GetWindowState(window)->SetStateObject(lock_state.Pass()));
11046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  return wm::GetWindowState(window);
11146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)}
11246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
11346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)void LockWindowState::UpdateWindow(wm::WindowState* window_state,
11446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)                                   wm::WindowStateType target_state) {
11546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  DCHECK(target_state == wm::WINDOW_STATE_TYPE_MINIMIZED ||
11646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)         target_state == wm::WINDOW_STATE_TYPE_MAXIMIZED ||
11746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)         (target_state == wm::WINDOW_STATE_TYPE_NORMAL &&
11846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)              !window_state->CanMaximize()) ||
11946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)         target_state == wm::WINDOW_STATE_TYPE_FULLSCREEN);
12046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
12146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  if (target_state == wm::WINDOW_STATE_TYPE_MINIMIZED) {
12246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    if (current_state_type_ == wm::WINDOW_STATE_TYPE_MINIMIZED)
12346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)      return;
12446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
12546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    current_state_type_ = target_state;
12646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    ::wm::SetWindowVisibilityAnimationType(
12746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)        window_state->window(), WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE);
12846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    window_state->window()->Hide();
12946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    if (window_state->IsActive())
13046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)      window_state->Deactivate();
13146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    return;
13246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  }
13346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
13446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  if (current_state_type_ == target_state) {
13546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    // If the state type did not change, update it accordingly.
13646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    UpdateBounds(window_state);
13746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    return;
13846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  }
13946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
14046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  const wm::WindowStateType old_state_type = current_state_type_;
14146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  current_state_type_ = target_state;
14246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  window_state->UpdateWindowShowStateFromStateType();
14346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  window_state->NotifyPreStateTypeChange(old_state_type);
14446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  UpdateBounds(window_state);
14546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  window_state->NotifyPostStateTypeChange(old_state_type);
14646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
14746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  if ((window_state->window()->TargetVisibility() ||
14846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)      old_state_type == wm::WINDOW_STATE_TYPE_MINIMIZED) &&
14946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)      !window_state->window()->layer()->visible()) {
15046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    // The layer may be hidden if the window was previously minimized. Make
15146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    // sure it's visible.
15246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    window_state->window()->Show();
15346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  }
15446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)}
15546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
15646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)wm::WindowStateType LockWindowState::GetMaximizedOrCenteredWindowType(
15746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)      wm::WindowState* window_state) {
15846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  return window_state->CanMaximize() ? wm::WINDOW_STATE_TYPE_MAXIMIZED :
15946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)                                       wm::WINDOW_STATE_TYPE_NORMAL;
16046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)}
16146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
16246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)void LockWindowState::UpdateBounds(wm::WindowState* window_state) {
1636d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)  if (!window_state->IsMaximized() && !window_state->IsFullscreen())
1646d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)    return;
1656d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)
16646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  keyboard::KeyboardController* keyboard_controller =
16746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)      keyboard::KeyboardController::GetInstance();
16846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  gfx::Rect keyboard_bounds;
16946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
17003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)  if (keyboard_controller &&
17103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)      !keyboard::IsKeyboardOverscrollEnabled() &&
17203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)      keyboard_controller->keyboard_visible()) {
17346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    keyboard_bounds = keyboard_controller->current_keyboard_bounds();
17403b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)  }
17546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
17646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  gfx::Rect bounds =
17746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)      ScreenUtil::GetDisplayBoundsInParent(window_state->window());
17846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  bounds.set_height(bounds.height() - keyboard_bounds.height());
17903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)
18003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)  VLOG(1) << "Updating window bounds to: " << bounds.ToString();
18146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  window_state->SetBoundsDirect(bounds);
18246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)}
18346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
18446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)}  // namespace ash
185