Add "Create shortcut..." back to "More tools" when PWA installation is enabled
This CL brings back "Create shortcut..." to the app menu's "More tools" section
even on installable PWA sites where we would originally omit it in favour
of showing "Install <app name>...".
Now we always show "Create shortcut..." and optionally show
"Install <app name>..." if the site is an installable PWA.
This splits the IDC_CREATE_HOSTED_APP command in two; IDC_CREATE_SHORTCUT
and IDC_INSTALL_PWA and plumbs a bool through to BookmarkAppHelper to
distinguish which type of install the user requested.
Bug: 887824
Change-Id: I432670327588f6639f374289664b3add4a6b7b81
Reviewed-on: https://chromium-review.googlesource.com/1226481
Reviewed-by: Ben Wells <[email protected]>
Reviewed-by: Avi Drissman <[email protected]>
Reviewed-by: Michael Wasserman <[email protected]>
Reviewed-by: Finnur Thorarinsson <[email protected]>
Reviewed-by: Giovanni Ortuño Urquidi <[email protected]>
Reviewed-by: Dominick Ng <[email protected]>
Commit-Queue: Alan Cutter <[email protected]>
Cr-Commit-Position: refs/heads/master@{#593767}diff --git a/chrome/browser/ui/browser_command_controller.cc b/chrome/browser/ui/browser_command_controller.cc
index cb59d0e3..773e715 100644
--- a/chrome/browser/ui/browser_command_controller.cc
+++ b/chrome/browser/ui/browser_command_controller.cc
@@ -563,8 +563,13 @@
case IDC_OPEN_FILE:
browser_->OpenFile();
break;
- case IDC_CREATE_HOSTED_APP:
- CreateBookmarkAppFromCurrentWebContents(browser_);
+ case IDC_CREATE_SHORTCUT:
+ CreateBookmarkAppFromCurrentWebContents(browser_,
+ true /* force_shortcut_app */);
+ break;
+ case IDC_INSTALL_PWA:
+ CreateBookmarkAppFromCurrentWebContents(browser_,
+ false /* force_shortcut_app */);
break;
case IDC_DEV_TOOLS:
ToggleDevToolsWindow(browser_, DevToolsToggleAction::Show());
@@ -1018,10 +1023,13 @@
if (browser_->is_devtools())
command_updater_.UpdateCommandEnabled(IDC_OPEN_FILE, false);
- command_updater_.UpdateCommandEnabled(IDC_CREATE_HOSTED_APP,
- CanCreateBookmarkApp(browser_));
+ bool can_create_bookmark_app = CanCreateBookmarkApp(browser_);
+ command_updater_.UpdateCommandEnabled(IDC_INSTALL_PWA,
+ can_create_bookmark_app);
+ command_updater_.UpdateCommandEnabled(IDC_CREATE_SHORTCUT,
+ can_create_bookmark_app);
command_updater_.UpdateCommandEnabled(IDC_OPEN_IN_PWA_WINDOW,
- CanCreateBookmarkApp(browser_));
+ can_create_bookmark_app);
command_updater_.UpdateCommandEnabled(
IDC_TOGGLE_REQUEST_TABLET_SITE,