Commit 1df2e8e9 authored by Eric Willigers's avatar Eric Willigers Committed by Commit Bot

Desktop PWAs: CreateWebApplicationWindow should support popup web apps

CreateWebApplicationWindow checks for disposition NEW_POPUP.

AppBrowserControllerBrowserTest.WhiteThemeForSystemAppPopup now passes
even when DesktopPWAsWithoutExtensions is enabled.

Bug: 1055645
Change-Id: Ifb15712c7bcebffba813f82ca7b7009618b31aaa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2071438Reviewed-by: default avatarAlexey Baskakov <loyso@chromium.org>
Commit-Queue: Eric Willigers <ericwilligers@chromium.org>
Cr-Commit-Position: refs/heads/master@{#744175}
parent 32d980f1
......@@ -148,7 +148,8 @@ Browser* LaunchSystemWebApp(Profile* profile,
if (base::FeatureList::IsEnabled(features::kDesktopPWAsWithoutExtensions)) {
if (!browser)
browser = CreateWebApplicationWindow(profile, params.app_id);
browser = CreateWebApplicationWindow(profile, params.app_id,
params.disposition);
// Navigate application window to application's |url| if necessary.
web_contents = browser->tab_strip_model()->GetWebContentsAt(0);
......
......@@ -62,12 +62,18 @@ void SetTabHelperAppId(content::WebContents* web_contents,
} // namespace
Browser* CreateWebApplicationWindow(Profile* profile,
const std::string& app_id) {
const std::string& app_id,
WindowOpenDisposition disposition) {
std::string app_name = GenerateApplicationNameFromAppId(app_id);
gfx::Rect initial_bounds;
auto browser_params = Browser::CreateParams::CreateForApp(
app_name, /*trusted_source=*/true, initial_bounds, profile,
/*user_gesture=*/true);
Browser::CreateParams browser_params =
disposition == WindowOpenDisposition::NEW_POPUP
? Browser::CreateParams::CreateForAppPopup(
app_name, /*trusted_source=*/true, initial_bounds, profile,
/*user_gesture=*/true)
: Browser::CreateParams::CreateForApp(
app_name, /*trusted_source=*/true, initial_bounds, profile,
/*user_gesture=*/true);
browser_params.initial_show_state = DetermineWindowShowState();
return new Browser(browser_params);
}
......@@ -137,7 +143,8 @@ content::WebContents* WebAppLaunchManager::OpenApplication(
/*user_gesture=*/true));
}
} else {
browser = CreateWebApplicationWindow(profile(), params.app_id);
browser = CreateWebApplicationWindow(profile(), params.app_id,
params.disposition);
}
content::WebContents* web_contents;
......
......@@ -59,7 +59,8 @@ class WebAppLaunchManager : public apps::LaunchManager {
};
Browser* CreateWebApplicationWindow(Profile* profile,
const std::string& app_id);
const std::string& app_id,
WindowOpenDisposition disposition);
content::WebContents* NavigateWebApplicationWindow(
Browser* browser,
......
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