| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/workspace/workspace_layout_manager.h" | 5 #include "ash/wm/workspace/workspace_layout_manager.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "ash/public/cpp/shell_window_ids.h" | 10 #include "ash/public/cpp/shell_window_ids.h" |
| 11 #include "ash/root_window_controller.h" | 11 #include "ash/root_window_controller.h" |
| 12 #include "ash/session/session_state_delegate.h" | 12 #include "ash/session/session_state_delegate.h" |
| 13 #include "ash/shelf/shelf.h" | 13 #include "ash/shelf/shelf.h" |
| 14 #include "ash/shelf/shelf_constants.h" | 14 #include "ash/shelf/shelf_constants.h" |
| 15 #include "ash/shelf/shelf_layout_manager.h" | 15 #include "ash/shelf/shelf_layout_manager.h" |
| 16 #include "ash/shell.h" | 16 #include "ash/shell.h" |
| 17 #include "ash/shell_observer.h" | 17 #include "ash/shell_observer.h" |
| 18 #include "ash/shell_port.h" | 18 #include "ash/shell_port.h" |
| 19 #include "ash/test/ash_test_base.h" | 19 #include "ash/test/ash_test_base.h" |
| 20 #include "ash/wm/fullscreen_window_finder.h" | 20 #include "ash/wm/fullscreen_window_finder.h" |
| 21 #include "ash/wm/window_state.h" | 21 #include "ash/wm/window_state.h" |
| 22 #include "ash/wm/window_util.h" | 22 #include "ash/wm/window_util.h" |
| 23 #include "ash/wm/wm_event.h" | 23 #include "ash/wm/wm_event.h" |
| 24 #include "ash/wm/workspace/workspace_window_resizer.h" | 24 #include "ash/wm/workspace/workspace_window_resizer.h" |
| 25 #include "ash/wm_window.h" | |
| 26 #include "base/command_line.h" | 25 #include "base/command_line.h" |
| 27 #include "ui/base/ui_base_switches.h" | 26 #include "ui/base/ui_base_switches.h" |
| 28 #include "ui/base/ui_base_types.h" | 27 #include "ui/base/ui_base_types.h" |
| 29 #include "ui/display/display.h" | 28 #include "ui/display/display.h" |
| 30 #include "ui/display/screen.h" | 29 #include "ui/display/screen.h" |
| 31 #include "ui/gfx/geometry/insets.h" | 30 #include "ui/gfx/geometry/insets.h" |
| 32 #include "ui/keyboard/keyboard_controller.h" | 31 #include "ui/keyboard/keyboard_controller.h" |
| 33 #include "ui/keyboard/keyboard_ui.h" | 32 #include "ui/keyboard/keyboard_ui.h" |
| 34 #include "ui/keyboard/keyboard_util.h" | 33 #include "ui/keyboard/keyboard_util.h" |
| 35 #include "ui/views/widget/widget.h" | 34 #include "ui/views/widget/widget.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 57 Shell::GetPrimaryRootWindowController()->GetContainer( | 56 Shell::GetPrimaryRootWindowController()->GetContainer( |
| 58 kShellWindowId_DefaultContainer); | 57 kShellWindowId_DefaultContainer); |
| 59 layout_manager_ = GetWorkspaceLayoutManager(default_container); | 58 layout_manager_ = GetWorkspaceLayoutManager(default_container); |
| 60 } | 59 } |
| 61 | 60 |
| 62 void ShowKeyboard() { | 61 void ShowKeyboard() { |
| 63 layout_manager_->OnKeyboardBoundsChanging(keyboard_bounds_); | 62 layout_manager_->OnKeyboardBoundsChanging(keyboard_bounds_); |
| 64 restore_work_area_insets_ = | 63 restore_work_area_insets_ = |
| 65 display::Screen::GetScreen()->GetPrimaryDisplay().GetWorkAreaInsets(); | 64 display::Screen::GetScreen()->GetPrimaryDisplay().GetWorkAreaInsets(); |
| 66 ShellPort::Get()->SetDisplayWorkAreaInsets( | 65 ShellPort::Get()->SetDisplayWorkAreaInsets( |
| 67 WmWindow::Get(Shell::GetPrimaryRootWindow()), | 66 Shell::GetPrimaryRootWindow(), |
| 68 gfx::Insets(0, 0, keyboard_bounds_.height(), 0)); | 67 gfx::Insets(0, 0, keyboard_bounds_.height(), 0)); |
| 69 } | 68 } |
| 70 | 69 |
| 71 void HideKeyboard() { | 70 void HideKeyboard() { |
| 72 ShellPort::Get()->SetDisplayWorkAreaInsets( | 71 ShellPort::Get()->SetDisplayWorkAreaInsets(Shell::GetPrimaryRootWindow(), |
| 73 WmWindow::Get(Shell::GetPrimaryRootWindow()), | 72 restore_work_area_insets_); |
| 74 restore_work_area_insets_); | |
| 75 layout_manager_->OnKeyboardBoundsChanging(gfx::Rect()); | 73 layout_manager_->OnKeyboardBoundsChanging(gfx::Rect()); |
| 76 } | 74 } |
| 77 | 75 |
| 78 // Initializes the keyboard bounds using the bottom half of the work area. | 76 // Initializes the keyboard bounds using the bottom half of the work area. |
| 79 void InitKeyboardBounds() { | 77 void InitKeyboardBounds() { |
| 80 gfx::Rect work_area( | 78 gfx::Rect work_area( |
| 81 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); | 79 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); |
| 82 keyboard_bounds_.SetRect(work_area.x(), | 80 keyboard_bounds_.SetRect(work_area.x(), |
| 83 work_area.y() + work_area.height() / 2, | 81 work_area.y() + work_area.height() / 2, |
| 84 work_area.width(), work_area.height() / 2); | 82 work_area.width(), work_area.height() / 2); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 changed_window_bounds.Offset(0, -shift); | 193 changed_window_bounds.Offset(0, -shift); |
| 196 // Window should be shifted up. | 194 // Window should be shifted up. |
| 197 EXPECT_EQ(changed_window_bounds, window->bounds()); | 195 EXPECT_EQ(changed_window_bounds, window->bounds()); |
| 198 | 196 |
| 199 kb_controller->HideKeyboard( | 197 kb_controller->HideKeyboard( |
| 200 keyboard::KeyboardController::HIDE_REASON_AUTOMATIC); | 198 keyboard::KeyboardController::HIDE_REASON_AUTOMATIC); |
| 201 EXPECT_EQ(orig_window_bounds, window->bounds()); | 199 EXPECT_EQ(orig_window_bounds, window->bounds()); |
| 202 } | 200 } |
| 203 | 201 |
| 204 } // namespace ash | 202 } // namespace ash |
| OLD | NEW |