Commit cb050a7c authored by Xiaoqian Dai's avatar Xiaoqian Dai Committed by Commit Bot

Only fallthrough to app list when in clamshell mode.

When overview, splitview and applist are active at the same time,
fallthrough to app list to handle the key events. Otherwise, it should
still be overview to handle the key events.

Bug: 970052, 969899
Change-Id: Ic090a5bc06aeb88ee286bfc35434cd19749e0221
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1642740Reviewed-by: default avatarSammie Quon <sammiequon@chromium.org>
Commit-Queue: Xiaoqian Dai <xdai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#666080}
parent 73b625d1
...@@ -820,8 +820,11 @@ void OverviewSession::OnKeyEvent(ui::KeyEvent* event) { ...@@ -820,8 +820,11 @@ void OverviewSession::OnKeyEvent(ui::KeyEvent* event) {
// TODO(crbug.com/952315): Explore better ways to handle this splitview + // TODO(crbug.com/952315): Explore better ways to handle this splitview +
// overview + applist case. // overview + applist case.
Shell* shell = Shell::Get(); Shell* shell = Shell::Get();
if (shell->app_list_controller() && shell->app_list_controller()->IsVisible()) if (shell->app_list_controller() &&
shell->app_list_controller()->IsVisible() &&
Shell::Get()->split_view_controller()->InClamshellSplitViewMode()) {
return; return;
}
if (event->type() != ui::ET_KEY_PRESSED) if (event->type() != ui::ET_KEY_PRESSED)
return; return;
......
...@@ -4402,6 +4402,27 @@ TEST_F(SplitViewOverviewSessionTest, ExitOverviewWithOneSnapped) { ...@@ -4402,6 +4402,27 @@ TEST_F(SplitViewOverviewSessionTest, ExitOverviewWithOneSnapped) {
EXPECT_FALSE(InOverviewSession()); EXPECT_FALSE(InOverviewSession());
} }
// Test that in tablet mode, pressing tab key in overview should not crash.
TEST_F(SplitViewOverviewSessionTest, NoCrashWhenPressTabKey) {
std::unique_ptr<aura::Window> window(CreateWindow(gfx::Rect(400, 400)));
std::unique_ptr<aura::Window> window2(CreateWindow(gfx::Rect(400, 400)));
// In overview, there should be no crash when pressing tab key.
ToggleOverview();
EXPECT_TRUE(InOverviewSession());
SendKey(ui::VKEY_TAB);
EXPECT_TRUE(InOverviewSession());
// When splitview and overview are both active, there should be no crash when
// pressing tab key.
split_view_controller()->SnapWindow(window.get(), SplitViewController::LEFT);
EXPECT_TRUE(InOverviewSession());
EXPECT_TRUE(split_view_controller()->InSplitViewMode());
SendKey(ui::VKEY_TAB);
EXPECT_TRUE(InOverviewSession());
}
// Test the split view and overview functionalities in clamshell mode. Split // Test the split view and overview functionalities in clamshell mode. Split
// view is only active when overview is active in clamshell mode. // view is only active when overview is active in clamshell mode.
class SplitViewOverviewSessionInClamshellTest class SplitViewOverviewSessionInClamshellTest
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment