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 | 8 |
9 #include "ash/display/display_layout.h" | 9 #include "ash/display/display_layout.h" |
10 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1014 } | 1014 } |
1015 | 1015 |
1016 aura::Window* CreateTestWindow(const gfx::Rect& bounds) { | 1016 aura::Window* CreateTestWindow(const gfx::Rect& bounds) { |
1017 return CreateTestWindowInShellWithBounds(bounds); | 1017 return CreateTestWindowInShellWithBounds(bounds); |
1018 } | 1018 } |
1019 | 1019 |
1020 void ShowKeyboard() { | 1020 void ShowKeyboard() { |
1021 layout_manager_->OnKeyboardBoundsChanging(keyboard_bounds_); | 1021 layout_manager_->OnKeyboardBoundsChanging(keyboard_bounds_); |
1022 restore_work_area_insets_ = Shell::GetScreen()->GetPrimaryDisplay(). | 1022 restore_work_area_insets_ = Shell::GetScreen()->GetPrimaryDisplay(). |
1023 GetWorkAreaInsets(); | 1023 GetWorkAreaInsets(); |
1024 Shell::GetInstance()->SetDisplayWorkAreaInsets( | 1024 Shell::GetInstance()->SetDisplayWorkAreaInsetsForTesting( |
1025 Shell::GetPrimaryRootWindow(), | 1025 Shell::GetPrimaryRootWindow(), |
1026 gfx::Insets(0, 0, keyboard_bounds_.height(), 0)); | 1026 gfx::Insets(0, 0, keyboard_bounds_.height(), 0)); |
1027 } | 1027 } |
1028 | 1028 |
1029 void HideKeyboard() { | 1029 void HideKeyboard() { |
1030 Shell::GetInstance()->SetDisplayWorkAreaInsets( | 1030 Shell::GetInstance()->SetDisplayWorkAreaInsetsForTesting( |
1031 Shell::GetPrimaryRootWindow(), | 1031 Shell::GetPrimaryRootWindow(), restore_work_area_insets_); |
1032 restore_work_area_insets_); | |
1033 layout_manager_->OnKeyboardBoundsChanging(gfx::Rect()); | 1032 layout_manager_->OnKeyboardBoundsChanging(gfx::Rect()); |
1034 } | 1033 } |
1035 | 1034 |
1036 void SetKeyboardBounds(const gfx::Rect& bounds) { | 1035 void SetKeyboardBounds(const gfx::Rect& bounds) { |
1037 keyboard_bounds_ = bounds; | 1036 keyboard_bounds_ = bounds; |
1038 } | 1037 } |
1039 | 1038 |
1040 private: | 1039 private: |
1041 gfx::Insets restore_work_area_insets_; | 1040 gfx::Insets restore_work_area_insets_; |
1042 gfx::Rect keyboard_bounds_; | 1041 gfx::Rect keyboard_bounds_; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1130 EXPECT_EQ(gfx::Rect(50, | 1129 EXPECT_EQ(gfx::Rect(50, |
1131 keyboard_bounds.y() - keyboard_bounds.height()/2, | 1130 keyboard_bounds.y() - keyboard_bounds.height()/2, |
1132 occluded_window_bounds.width(), | 1131 occluded_window_bounds.width(), |
1133 occluded_window_bounds.height()).ToString(), | 1132 occluded_window_bounds.height()).ToString(), |
1134 window->bounds().ToString()); | 1133 window->bounds().ToString()); |
1135 HideKeyboard(); | 1134 HideKeyboard(); |
1136 EXPECT_EQ(occluded_window_bounds.ToString(), window->bounds().ToString()); | 1135 EXPECT_EQ(occluded_window_bounds.ToString(), window->bounds().ToString()); |
1137 } | 1136 } |
1138 | 1137 |
1139 } // namespace ash | 1138 } // namespace ash |
OLD | NEW |