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

chromeos: Trigger window bounce animations via mojo call to ash

This fixes several shelf browser_tests under SingleProcessMash. It also
makes the window bounce animations include the window frame, not just
the content area.

Bug: 855767
Test: browser_tests ShelfApp*
Change-Id: I2d09d7162104bfb65c7a51507304f71a92d87377
Reviewed-on: https://chromium-review.googlesource.com/c/1287183Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarTom Sepez <tsepez@chromium.org>
Commit-Queue: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600598}
parent 301234b8
...@@ -27,4 +27,7 @@ interface AshWindowManager { ...@@ -27,4 +27,7 @@ interface AshWindowManager {
// Maximizes the window in response to a double click or tap on the HTCAPTION // Maximizes the window in response to a double click or tap on the HTCAPTION
// area. // area.
MaximizeWindowByCaptionClick(uint64 window_id, ui.mojom.PointerKind pointer); MaximizeWindowByCaptionClick(uint64 window_id, ui.mojom.PointerKind pointer);
// Plays the window bounce animation (scale the window up and down).
BounceWindow(uint64 window_id);
}; };
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "base/logging.h" #include "base/logging.h"
#include "base/metrics/user_metrics.h" #include "base/metrics/user_metrics.h"
#include "services/ws/window_tree.h" #include "services/ws/window_tree.h"
#include "ui/wm/core/window_animations.h"
namespace ash { namespace ash {
...@@ -76,4 +77,13 @@ void AshWindowManager::MaximizeWindowByCaptionClick( ...@@ -76,4 +77,13 @@ void AshWindowManager::MaximizeWindowByCaptionClick(
wm::GetWindowState(window)->OnWMEvent(&wm_event); wm::GetWindowState(window)->OnWMEvent(&wm_event);
} }
void AshWindowManager::BounceWindow(ws::Id window_id) {
aura::Window* window = window_tree_->GetWindowByTransportId(window_id);
if (!window || !window_tree_->IsTopLevel(window)) {
DVLOG(1) << "BounceWindow passed invalid window, id=" << window_id;
return;
}
::wm::AnimateWindow(window, ::wm::WINDOW_ANIMATION_TYPE_BOUNCE);
}
} // namespace ash } // namespace ash
...@@ -35,6 +35,7 @@ class AshWindowManager : public mojom::AshWindowManager, ...@@ -35,6 +35,7 @@ class AshWindowManager : public mojom::AshWindowManager,
void CommitSnap(ws::Id window_id, mojom::SnapDirection snap) override; void CommitSnap(ws::Id window_id, mojom::SnapDirection snap) override;
void MaximizeWindowByCaptionClick(ws::Id window_id, void MaximizeWindowByCaptionClick(ws::Id window_id,
ui::mojom::PointerKind pointer) override; ui::mojom::PointerKind pointer) override;
void BounceWindow(ws::Id window_id) override;
private: private:
ws::WindowTree* window_tree_; ws::WindowTree* window_tree_;
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "ash/accelerators/accelerator_controller.h" #include "ash/accelerators/accelerator_controller.h"
#include "ash/public/cpp/shell_window_ids.h" #include "ash/public/cpp/shell_window_ids.h"
#include "ash/public/interfaces/ash_window_manager.mojom.h"
#include "ash/public/interfaces/event_properties.mojom.h" #include "ash/public/interfaces/event_properties.mojom.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "base/macros.h" #include "base/macros.h"
...@@ -13,10 +14,14 @@ ...@@ -13,10 +14,14 @@
#include "mojo/public/cpp/bindings/type_converter.h" #include "mojo/public/cpp/bindings/type_converter.h"
#include "services/ws/public/cpp/property_type_converters.h" #include "services/ws/public/cpp/property_type_converters.h"
#include "services/ws/public/mojom/window_manager.mojom.h" #include "services/ws/public/mojom/window_manager.mojom.h"
#include "ui/aura/mus/window_mus.h"
#include "ui/aura/mus/window_tree_client.h"
#include "ui/aura/window_event_dispatcher.h" #include "ui/aura/window_event_dispatcher.h"
#include "ui/base/ui_base_features.h" #include "ui/base/ui_base_features.h"
#include "ui/display/display.h" #include "ui/display/display.h"
#include "ui/display/screen.h" #include "ui/display/screen.h"
#include "ui/views/mus/mus_client.h"
#include "ui/wm/core/window_animations.h"
namespace ash_util { namespace ash_util {
...@@ -60,4 +65,17 @@ service_manager::Connector* GetServiceManagerConnector() { ...@@ -60,4 +65,17 @@ service_manager::Connector* GetServiceManagerConnector() {
return manager_connection->GetConnector(); return manager_connection->GetConnector();
} }
void BounceWindow(aura::Window* window) {
if (features::IsUsingWindowService()) {
const uint64_t window_id =
aura::WindowMus::Get(window->GetRootWindow())->server_id();
views::MusClient::Get()
->window_tree_client()
->BindWindowManagerInterface<ash::mojom::AshWindowManager>()
->BounceWindow(window_id);
} else {
wm::AnimateWindow(window, wm::WINDOW_ANIMATION_TYPE_BOUNCE);
}
}
} // namespace ash_util } // namespace ash_util
...@@ -9,6 +9,10 @@ ...@@ -9,6 +9,10 @@
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
namespace aura {
class Window;
}
namespace service_manager { namespace service_manager {
class Connector; class Connector;
} }
...@@ -38,6 +42,11 @@ void SetupWidgetInitParamsForContainer(views::Widget::InitParams* params, ...@@ -38,6 +42,11 @@ void SetupWidgetInitParamsForContainer(views::Widget::InitParams* params,
// May be null in unit tests. // May be null in unit tests.
service_manager::Connector* GetServiceManagerConnector(); service_manager::Connector* GetServiceManagerConnector();
// Triggers the window bounce animation inside ash. Handled on the ash side so
// the window frame is included in the bounce and to avoid sending IPCs for
// window transform updates.
void BounceWindow(aura::Window* window);
} // namespace ash_util } // namespace ash_util
#endif // CHROME_BROWSER_UI_ASH_ASH_UTIL_H_ #endif // CHROME_BROWSER_UI_ASH_ASH_UTIL_H_
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "chrome/browser/extensions/launch_util.h" #include "chrome/browser/extensions/launch_util.h"
#include "chrome/browser/ui/app_list/arc/arc_app_utils.h" #include "chrome/browser/ui/app_list/arc/arc_app_utils.h"
#include "chrome/browser/ui/ash/ash_util.h"
#include "chrome/browser/ui/ash/launcher/arc_playstore_shortcut_launcher_item_controller.h" #include "chrome/browser/ui/ash/launcher/arc_playstore_shortcut_launcher_item_controller.h"
#include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
#include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h" #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h"
...@@ -33,7 +34,6 @@ ...@@ -33,7 +34,6 @@
#include "extensions/browser/process_manager.h" #include "extensions/browser/process_manager.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
#include "ui/events/event.h" #include "ui/events/event.h"
#include "ui/wm/core/window_animations.h"
using extensions::Extension; using extensions::Extension;
using extensions::ExtensionRegistry; using extensions::ExtensionRegistry;
...@@ -340,8 +340,7 @@ bool AppShortcutLauncherItemController::AdvanceToNextApp() { ...@@ -340,8 +340,7 @@ bool AppShortcutLauncherItemController::AdvanceToNextApp() {
if (items.size() == 1) { if (items.size() == 1) {
// If there is only a single item available, we animate it upon key // If there is only a single item available, we animate it upon key
// action. // action.
AnimateWindow(browser->window()->GetNativeWindow(), ash_util::BounceWindow(browser->window()->GetNativeWindow());
wm::WINDOW_ANIMATION_TYPE_BOUNCE);
} else { } else {
int index = (static_cast<int>(i - items.begin()) + 1) % items.size(); int index = (static_cast<int>(i - items.begin()) + 1) % items.size();
ActivateContent(items[index]); ActivateContent(items[index]);
......
...@@ -8,13 +8,13 @@ ...@@ -8,13 +8,13 @@
#include <utility> #include <utility>
#include "ash/public/cpp/shelf_types.h" #include "ash/public/cpp/shelf_types.h"
#include "chrome/browser/ui/ash/ash_util.h"
#include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
#include "chrome/browser/ui/ash/launcher/launcher_context_menu.h" #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h"
#include "chrome/browser/ui/ash/launcher/launcher_controller_helper.h" #include "chrome/browser/ui/ash/launcher/launcher_controller_helper.h"
#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
#include "ui/base/base_window.h" #include "ui/base/base_window.h"
#include "ui/wm/core/window_animations.h"
#include "ui/wm/core/window_util.h" #include "ui/wm/core/window_util.h"
AppWindowLauncherItemController::AppWindowLauncherItemController( AppWindowLauncherItemController::AppWindowLauncherItemController(
...@@ -171,8 +171,7 @@ AppWindowLauncherItemController::ActivateOrAdvanceToNextAppWindow( ...@@ -171,8 +171,7 @@ AppWindowLauncherItemController::ActivateOrAdvanceToNextAppWindow(
if (window_to_show->IsActive()) { if (window_to_show->IsActive()) {
// Coming here, only a single window is active. For keyboard activations // Coming here, only a single window is active. For keyboard activations
// the window gets animated. // the window gets animated.
AnimateWindow(window_to_show->GetNativeWindow(), ash_util::BounceWindow(window_to_show->GetNativeWindow());
wm::WINDOW_ANIMATION_TYPE_BOUNCE);
} else { } else {
return ShowAndActivateOrMinimize(window_to_show); return ShowAndActivateOrMinimize(window_to_show);
} }
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "ash/public/cpp/window_properties.h" #include "ash/public/cpp/window_properties.h"
#include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/chromeos/crostini/crostini_util.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/ash/ash_util.h"
#include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
#include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h" #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h"
#include "chrome/browser/ui/ash/launcher/launcher_context_menu.h" #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h"
...@@ -37,7 +38,6 @@ ...@@ -37,7 +38,6 @@
#include "ui/events/event.h" #include "ui/events/event.h"
#include "ui/events/event_constants.h" #include "ui/events/event_constants.h"
#include "ui/gfx/image/image.h" #include "ui/gfx/image/image.h"
#include "ui/wm/core/window_animations.h"
namespace { namespace {
...@@ -320,8 +320,7 @@ BrowserShortcutLauncherItemController::ActivateOrAdvanceToNextBrowser() { ...@@ -320,8 +320,7 @@ BrowserShortcutLauncherItemController::ActivateOrAdvanceToNextBrowser() {
// If there is only one suitable browser, we can either activate it, or // If there is only one suitable browser, we can either activate it, or
// bounce it (if it is already active). // bounce it (if it is already active).
if (items[0]->window()->IsActive()) { if (items[0]->window()->IsActive()) {
AnimateWindow(items[0]->window()->GetNativeWindow(), ash_util::BounceWindow(items[0]->window()->GetNativeWindow());
wm::WINDOW_ANIMATION_TYPE_BOUNCE);
return ash::SHELF_ACTION_NONE; return ash::SHELF_ACTION_NONE;
} }
browser = items[0]; browser = items[0];
......
...@@ -1501,6 +1501,9 @@ void WindowTree::SetWindowBounds( ...@@ -1501,6 +1501,9 @@ void WindowTree::SetWindowBounds(
void WindowTree::SetWindowTransform(uint32_t change_id, void WindowTree::SetWindowTransform(uint32_t change_id,
Id window_id, Id window_id,
const gfx::Transform& transform) { const gfx::Transform& transform) {
// NOTE: Tests may time out if they trigger this NOTIMPLEMENTED because
// the change is not ack'd. The code under test may need to change to
// avoid triggering window transforms outside the window manager.
NOTIMPLEMENTED_LOG_ONCE(); NOTIMPLEMENTED_LOG_ONCE();
} }
......
...@@ -109,12 +109,9 @@ ...@@ -109,12 +109,9 @@
-AppWindowApiTest.OnRestoredEvent -AppWindowApiTest.OnRestoredEvent
-BrowserActionApiTest.BrowserActionPopupWithIframe -BrowserActionApiTest.BrowserActionPopupWithIframe
-FirstRunUIBrowserTest.ModalWindowDoesNotBlock -FirstRunUIBrowserTest.ModalWindowDoesNotBlock
-LauncherPlatformAppBrowserTest.AltNumberAppsTabbing
-LauncherPlatformAppBrowserTest.PackagedAppClickBehaviorInMinimizeMode -LauncherPlatformAppBrowserTest.PackagedAppClickBehaviorInMinimizeMode
-LoginWebDialogTest.CannotMinimize -LoginWebDialogTest.CannotMinimize
-LoginWebDialogTest.CloseDialogByAccelerator -LoginWebDialogTest.CloseDialogByAccelerator
-ShelfAppBrowserTest.AltNumberTabsTabbing
-ShelfAppBrowserTestNoDefaultBrowser.AltNumberBrowserTabbing
-ShelfAppBrowserTestNoDefaultBrowser.BrowserShortcutLauncherItemController -ShelfAppBrowserTestNoDefaultBrowser.BrowserShortcutLauncherItemController
# Excluded from Mash because pointer events from EventGenerator aren't seen. # Excluded from Mash because pointer events from EventGenerator aren't seen.
......
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