Commit 5039a87b authored by Wei Lee's avatar Wei Lee Committed by Commit Bot

CCA: Minimze/Restore window when receiving onLaunched event

Currently we just drop the event when there is active window instance.
We should minimize/restore the active window when receiving onLaunched
event.

Bug: b/155027774
Test: Manually test
Change-Id: I41ddf53cfb439ad6b32ae628c35e271d709561eb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2167739Reviewed-by: default avatarKuo Jen Wei <inker@chromium.org>
Reviewed-by: default avatarShik Chen <shik@chromium.org>
Commit-Queue: Wei Lee <wtlee@chromium.org>
Cr-Commit-Position: refs/heads/master@{#763298}
parent 1a0d6db0
......@@ -269,6 +269,18 @@ class CCAWindow {
this.state_ = WindowState.CLOSING;
this.appWindow_.close();
}
/**
* Minimize or restore the app window.
*/
minimizeOrRestore() {
if (this.appWindow_.isMinimized()) {
this.appWindow_.restore();
this.appWindow_.focus();
} else {
this.appWindow_.minimize();
}
}
}
/**
......@@ -416,6 +428,11 @@ class Background {
*/
launchApp() {
if (this.launcherWindow_ || this.intentWindow_) {
const activeWindow = [this.launcherWindow_, this.intentWindow_].find(
(wnd) => wnd !== null && wnd.state_ === WindowState.ACTIVE);
if (activeWindow !== undefined) {
activeWindow.minimizeOrRestore();
}
return;
}
this.assert_(
......
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