Commit d485dc5c authored by James Cook's avatar James Cook Committed by Commit Bot

chromeos: Pass visibility state changes to client

This fixes a problem with restoring minimized windows. The client needs
to know that the window is not visible to know that it is allowed to
restore it.

Fixes the following tests:
-AppWindowApiTest.OnRestoredEvent
-BrowserActionApiTest.BrowserActionPopupWithIframe
-FirstRunUIBrowserTest.ModalWindowDoesNotBlock
-LauncherPlatformAppBrowserTest.PackagedAppClickBehaviorInMinimizeMode
-LoginWebDialogTest.CannotMinimize
-LoginWebDialogTest.CloseDialogByAccelerator
-ShelfAppBrowserTestNoDefaultBrowser.BrowserShortcutLauncherItemController

Bug: 855767
Test: added to services_unittests
Change-Id: Icb1a12e4dd18f68807bf0dc9140ce289e9ea913c
Reviewed-on: https://chromium-review.googlesource.com/c/1292053Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601349}
parent dfaf5f20
......@@ -32,6 +32,8 @@ enum class ClientChangeType {
kFocus,
// Used for WindowTree::SetWindowProperty().
kProperty,
// Used for WindowTree::SetWindowVisibility().
kVisibility,
};
// ClientChange represents an incoming request from a WindowTreeClient. For
......
......@@ -1025,6 +1025,8 @@ bool WindowTree::SetWindowVisibilityImpl(const ClientWindowId& window_id,
(IsClientRootWindow(window) && can_change_root_window_visibility_)) {
if (window->TargetVisibility() == visible)
return true;
ClientChange change(property_change_tracker_.get(), window,
ClientChangeType::kVisibility);
if (visible)
window->Show();
else
......@@ -1366,6 +1368,16 @@ void WindowTree::OnWindowDestroyed(aura::Window* window) {
RemoveWindowFromKnownWindows(window, delete_if_owned);
}
void WindowTree::OnWindowVisibilityChanging(aura::Window* window,
bool visible) {
if (property_change_tracker_->IsProcessingChangeForWindow(
window, ClientChangeType::kVisibility)) {
return;
}
window_tree_client_->OnWindowVisibilityChanged(TransportIdForWindow(window),
visible);
}
void WindowTree::OnCaptureChanged(aura::Window* lost_capture,
aura::Window* gained_capture) {
if (property_change_tracker_->IsProcessingChangeForWindow(
......
......@@ -356,6 +356,7 @@ class COMPONENT_EXPORT(WINDOW_SERVICE) WindowTree
// aura::WindowObserver:
void OnWindowHierarchyChanging(const HierarchyChangeParams& params) override;
void OnWindowDestroyed(aura::Window* window) override;
void OnWindowVisibilityChanging(aura::Window* window, bool visible) override;
// aura::client::CaptureClientObserver:
void OnCaptureChanged(aura::Window* lost_capture,
......
......@@ -1723,6 +1723,18 @@ TEST(WindowTreeTest, StackAbove) {
top_level1, non_top_level_window));
}
TEST(WindowTreeTest, VisibilityChanged) {
WindowServiceTestSetup setup;
aura::Window* window = setup.window_tree_test_helper()->NewTopLevelWindow();
setup.changes()->clear();
EXPECT_FALSE(window->IsVisible());
window->Show();
EXPECT_TRUE(window->IsVisible());
EXPECT_EQ("VisibilityChanged window=0,1 visible=true",
SingleChangeToDescription(*setup.changes()));
}
TEST(WindowTreeTest, RunMoveLoopTouch) {
WindowServiceTestSetup setup;
aura::Window* top_level =
......@@ -1740,6 +1752,7 @@ TEST(WindowTreeTest, RunMoveLoopTouch) {
// Make the window visible and repeat.
top_level->Show();
setup.changes()->clear();
setup.window_tree_test_helper()->window_tree()->PerformWindowMove(
13, top_level_id, mojom::MoveLoopSource::TOUCH, gfx::Point());
// WindowServiceDelegate should be asked to do the move.
......
......@@ -264,16 +264,6 @@
-PlatformAppBrowserTest.PictureInPicture
-PictureInPictureLazyBackgroundPageApiTest.PictureInPictureInBackgroundPage
# These started failing with the switch to ws2.
# https:://crbug.com/855767
-AppWindowApiTest.OnRestoredEvent
-BrowserActionApiTest.BrowserActionPopupWithIframe
-FirstRunUIBrowserTest.ModalWindowDoesNotBlock
-LauncherPlatformAppBrowserTest.PackagedAppClickBehaviorInMinimizeMode
-LoginWebDialogTest.CannotMinimize
-LoginWebDialogTest.CloseDialogByAccelerator
-ShelfAppBrowserTestNoDefaultBrowser.BrowserShortcutLauncherItemController
# Excluded from Mash because pointer events from EventGenerator aren't seen.
# https://crbug.com/814675
-ChromeOSInfoPrivateTest.StylusSeen
......
......@@ -94,16 +94,6 @@
-PlatformAppBrowserTest.PictureInPicture
-PictureInPictureLazyBackgroundPageApiTest.PictureInPictureInBackgroundPage
# These started failing with the switch to ws2.
# https://crbug.com/855767
-AppWindowApiTest.OnRestoredEvent
-BrowserActionApiTest.BrowserActionPopupWithIframe
-FirstRunUIBrowserTest.ModalWindowDoesNotBlock
-LauncherPlatformAppBrowserTest.PackagedAppClickBehaviorInMinimizeMode
-LoginWebDialogTest.CannotMinimize
-LoginWebDialogTest.CloseDialogByAccelerator
-ShelfAppBrowserTestNoDefaultBrowser.BrowserShortcutLauncherItemController
# Excluded from Mash because pointer events from EventGenerator aren't seen.
# https://crbug.com/814675
-ChromeOSInfoPrivateTest.StylusSeen
......
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