| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/display/display_manager.h" | 5 #include "ash/display/display_manager.h" |
| 6 #include "ash/root_window_controller.h" | 6 #include "ash/root_window_controller.h" |
| 7 #include "ash/screen_util.h" | 7 #include "ash/screen_util.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
| 10 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
| 11 #include "ash/wm/window_state.h" | 11 #include "ash/wm/window_state.h" |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "ui/aura/client/aura_constants.h" | 14 #include "ui/aura/client/aura_constants.h" |
| 15 #include "ui/aura/window.h" | 15 #include "ui/aura/window.h" |
| 16 #include "ui/gfx/screen.h" | 16 #include "ui/gfx/screen.h" |
| 17 #include "ui/keyboard/keyboard_controller.h" | 17 #include "ui/keyboard/keyboard_controller.h" |
| 18 #include "ui/keyboard/keyboard_controller_proxy.h" | |
| 19 #include "ui/keyboard/keyboard_switches.h" | 18 #include "ui/keyboard/keyboard_switches.h" |
| 19 #include "ui/keyboard/keyboard_ui.h" |
| 20 #include "ui/keyboard/keyboard_util.h" | 20 #include "ui/keyboard/keyboard_util.h" |
| 21 #include "ui/views/widget/widget.h" | 21 #include "ui/views/widget/widget.h" |
| 22 #include "ui/views/widget/widget_delegate.h" | 22 #include "ui/views/widget/widget_delegate.h" |
| 23 | 23 |
| 24 namespace ash { | 24 namespace ash { |
| 25 namespace test { | 25 namespace test { |
| 26 | 26 |
| 27 namespace { | 27 namespace { |
| 28 | 28 |
| 29 const int kVirtualKeyboardHeight = 100; | 29 const int kVirtualKeyboardHeight = 100; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 // Show or hide the keyboard. | 84 // Show or hide the keyboard. |
| 85 void ShowKeyboard(bool show) { | 85 void ShowKeyboard(bool show) { |
| 86 keyboard::KeyboardController* keyboard = | 86 keyboard::KeyboardController* keyboard = |
| 87 keyboard::KeyboardController::GetInstance(); | 87 keyboard::KeyboardController::GetInstance(); |
| 88 ASSERT_TRUE(keyboard); | 88 ASSERT_TRUE(keyboard); |
| 89 if (show == keyboard->keyboard_visible()) | 89 if (show == keyboard->keyboard_visible()) |
| 90 return; | 90 return; |
| 91 | 91 |
| 92 if (show) { | 92 if (show) { |
| 93 keyboard->ShowKeyboard(true); | 93 keyboard->ShowKeyboard(true); |
| 94 if (keyboard->proxy()->GetKeyboardWindow()->bounds().height() == 0) { | 94 if (keyboard->ui()->GetKeyboardWindow()->bounds().height() == 0) { |
| 95 keyboard->proxy()->GetKeyboardWindow()->SetBounds( | 95 keyboard->ui()->GetKeyboardWindow()->SetBounds( |
| 96 keyboard::FullWidthKeyboardBoundsFromRootBounds( | 96 keyboard::FullWidthKeyboardBoundsFromRootBounds( |
| 97 Shell::GetPrimaryRootWindow()->bounds(), | 97 Shell::GetPrimaryRootWindow()->bounds(), |
| 98 kVirtualKeyboardHeight)); | 98 kVirtualKeyboardHeight)); |
| 99 } | 99 } |
| 100 } else { | 100 } else { |
| 101 keyboard->HideKeyboard(keyboard::KeyboardController::HIDE_REASON_MANUAL); | 101 keyboard->HideKeyboard(keyboard::KeyboardController::HIDE_REASON_MANUAL); |
| 102 } | 102 } |
| 103 | 103 |
| 104 DCHECK_EQ(show, keyboard->keyboard_visible()); | 104 DCHECK_EQ(show, keyboard->keyboard_visible()); |
| 105 } | 105 } |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 // When virtual keyboard overscroll is disabled keyboard bounds do | 224 // When virtual keyboard overscroll is disabled keyboard bounds do |
| 225 // affect window bounds. | 225 // affect window bounds. |
| 226 keyboard::SetKeyboardOverscrollOverride( | 226 keyboard::SetKeyboardOverscrollOverride( |
| 227 keyboard::KEYBOARD_OVERSCROLL_OVERRIDE_DISABLED); | 227 keyboard::KEYBOARD_OVERSCROLL_OVERRIDE_DISABLED); |
| 228 ShowKeyboard(true); | 228 ShowKeyboard(true); |
| 229 keyboard::KeyboardController* keyboard = | 229 keyboard::KeyboardController* keyboard = |
| 230 keyboard::KeyboardController::GetInstance(); | 230 keyboard::KeyboardController::GetInstance(); |
| 231 primary_display = Shell::GetScreen()->GetPrimaryDisplay(); | 231 primary_display = Shell::GetScreen()->GetPrimaryDisplay(); |
| 232 screen_bounds = primary_display.bounds(); | 232 screen_bounds = primary_display.bounds(); |
| 233 gfx::Rect target_bounds(screen_bounds); | 233 gfx::Rect target_bounds(screen_bounds); |
| 234 target_bounds.set_height(target_bounds.height() - | 234 target_bounds.set_height( |
| 235 keyboard->proxy()->GetKeyboardWindow()->bounds().height()); | 235 target_bounds.height() - |
| 236 keyboard->ui()->GetKeyboardWindow()->bounds().height()); |
| 236 EXPECT_EQ(target_bounds.ToString(), window->GetBoundsInScreen().ToString()); | 237 EXPECT_EQ(target_bounds.ToString(), window->GetBoundsInScreen().ToString()); |
| 237 ShowKeyboard(false); | 238 ShowKeyboard(false); |
| 238 | 239 |
| 239 keyboard::SetKeyboardOverscrollOverride( | 240 keyboard::SetKeyboardOverscrollOverride( |
| 240 keyboard::KEYBOARD_OVERSCROLL_OVERRIDE_NONE); | 241 keyboard::KEYBOARD_OVERSCROLL_OVERRIDE_NONE); |
| 241 } | 242 } |
| 242 | 243 |
| 243 TEST_F(LockLayoutManagerTest, MultipleMonitors) { | 244 TEST_F(LockLayoutManagerTest, MultipleMonitors) { |
| 244 if (!SupportsMultipleDisplays()) | 245 if (!SupportsMultipleDisplays()) |
| 245 return; | 246 return; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window.get()); | 286 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window.get()); |
| 286 window->SetBounds(work_area); | 287 window->SetBounds(work_area); |
| 287 // Usually work_area takes Shelf into account but that doesn't affect | 288 // Usually work_area takes Shelf into account but that doesn't affect |
| 288 // LockScreen container windows. | 289 // LockScreen container windows. |
| 289 EXPECT_NE(work_area.ToString(), window->GetBoundsInScreen().ToString()); | 290 EXPECT_NE(work_area.ToString(), window->GetBoundsInScreen().ToString()); |
| 290 EXPECT_EQ(screen_bounds.ToString(), window->GetBoundsInScreen().ToString()); | 291 EXPECT_EQ(screen_bounds.ToString(), window->GetBoundsInScreen().ToString()); |
| 291 } | 292 } |
| 292 | 293 |
| 293 } // namespace test | 294 } // namespace test |
| 294 } // namespace ash | 295 } // namespace ash |
| OLD | NEW |