Commit 96b864cc authored by Christopher Cameron's avatar Christopher Cameron Committed by Commit Bot

MacPWAs: Reparent tabs when installing PWAs

This works now. When re-parenting the window, the initial attempt to
re-parent the window fails, because the PWA's bundle has not yet
been created. The second attempt then re-creates the bundle and
succeeds. This is a bit kludgey in that it is possible that the bundle
will be recreated twice.

A cleaner solution would be to delay reparenting the contents and
revealing the app in Finder until the app has been created, but that
solution may not be suitable for merge.

Bug: 859152
Change-Id: Ifaf507525729a9a168e821f722aee03e9f6dd8f4
Reviewed-on: https://chromium-review.googlesource.com/c/1438037Reviewed-by: default avatarBen Wells <benwells@chromium.org>
Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Commit-Queue: ccameron <ccameron@chromium.org>
Cr-Commit-Position: refs/heads/master@{#627151}
parent 782cd1a1
...@@ -531,6 +531,7 @@ void BookmarkAppHelper::FinishInstallation(const Extension* extension) { ...@@ -531,6 +531,7 @@ void BookmarkAppHelper::FinishInstallation(const Extension* extension) {
} }
#endif // !defined(OS_CHROMEOS) #endif // !defined(OS_CHROMEOS)
} }
#endif // !defined(OS_MACOSX)
// Reparent the tab into an app window immediately when opening as a window. // Reparent the tab into an app window immediately when opening as a window.
if (!silent_install && if (!silent_install &&
...@@ -538,7 +539,6 @@ void BookmarkAppHelper::FinishInstallation(const Extension* extension) { ...@@ -538,7 +539,6 @@ void BookmarkAppHelper::FinishInstallation(const Extension* extension) {
launch_type == LAUNCH_TYPE_WINDOW && !profile_->IsOffTheRecord()) { launch_type == LAUNCH_TYPE_WINDOW && !profile_->IsOffTheRecord()) {
ReparentWebContentsIntoAppBrowser(contents_, extension); ReparentWebContentsIntoAppBrowser(contents_, extension);
} }
#endif // !defined(OS_MACOSX)
callback_.Run(extension, web_app_info_); callback_.Run(extension, web_app_info_);
} }
......
...@@ -184,12 +184,10 @@ IN_PROC_BROWSER_TEST_F(BookmarkAppHelperTest, CreateWindowedPWAIntoAppWindow) { ...@@ -184,12 +184,10 @@ IN_PROC_BROWSER_TEST_F(BookmarkAppHelperTest, CreateWindowedPWAIntoAppWindow) {
bookmark_app_helper_->web_app_info_); bookmark_app_helper_->web_app_info_);
Wait(); // Quits when the extension install completes. Wait(); // Quits when the extension install completes.
#if !defined(OS_MACOSX)
// We do not reparent the tab on OS X. // We do not reparent the tab on OS X.
Browser* app_browser = chrome::FindBrowserWithWebContents(web_contents()); Browser* app_browser = chrome::FindBrowserWithWebContents(web_contents());
EXPECT_TRUE(app_browser->is_app()); EXPECT_TRUE(app_browser->is_app());
EXPECT_NE(app_browser, browser()); EXPECT_NE(app_browser, browser());
#endif // defined(OS_MACOSX)
} }
} // namespace extensions } // namespace extensions
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