Commit 6a70ccaf authored by Alan Cutter's avatar Alan Cutter Committed by Commit Bot

Remove kDesktopPWAsWithoutExtensions flag check in AppServiceContextMenu

The kWeb branch in AppServiceContextMenu::IsCommandIdChecked() is
capable of handling web apps that run using BMO or Extensions as the
backend. This CL removes the flag check and fallthrough behaviour.

Bug: 897314
Change-Id: I530988629aa92e13d3cac9ccb8bcd500c1e7f7c1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2087247
Auto-Submit: Alan Cutter <alancutter@chromium.org>
Reviewed-by: default avatarNancy Wang <nancylingwang@chromium.org>
Commit-Queue: Alan Cutter <alancutter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#747462}
parent dc9689a6
......@@ -154,22 +154,17 @@ void AppServiceContextMenu::ExecuteCommand(int command_id, int event_flags) {
bool AppServiceContextMenu::IsCommandIdChecked(int command_id) const {
switch (app_type_) {
case apps::mojom::AppType::kWeb:
if (base::FeatureList::IsEnabled(
features::kDesktopPWAsWithoutExtensions)) {
if (command_id >= ash::USE_LAUNCH_TYPE_COMMAND_START &&
command_id < ash::USE_LAUNCH_TYPE_COMMAND_END) {
auto* provider = web_app::WebAppProvider::Get(profile());
DCHECK(provider);
web_app::DisplayMode effective_display_mode =
provider->registrar().GetAppEffectiveDisplayMode(app_id());
return effective_display_mode != web_app::DisplayMode::kUndefined &&
effective_display_mode ==
ConvertUseLaunchTypeCommandToDisplayMode(command_id);
}
return AppContextMenu::IsCommandIdChecked(command_id);
if (command_id >= ash::USE_LAUNCH_TYPE_COMMAND_START &&
command_id < ash::USE_LAUNCH_TYPE_COMMAND_END) {
auto* provider = web_app::WebAppProvider::Get(profile());
DCHECK(provider);
web_app::DisplayMode effective_display_mode =
provider->registrar().GetAppEffectiveDisplayMode(app_id());
return effective_display_mode != web_app::DisplayMode::kUndefined &&
effective_display_mode ==
ConvertUseLaunchTypeCommandToDisplayMode(command_id);
}
// Otherwise deliberately fall through to fallback on Bookmark Apps.
FALLTHROUGH;
return AppContextMenu::IsCommandIdChecked(command_id);
case apps::mojom::AppType::kExtension:
if (command_id >= ash::USE_LAUNCH_TYPE_COMMAND_START &&
command_id < ash::USE_LAUNCH_TYPE_COMMAND_END) {
......@@ -295,22 +290,18 @@ void AppServiceContextMenu::ShowAppInfo() {
void AppServiceContextMenu::SetLaunchType(int command_id) {
switch (app_type_) {
case apps::mojom::AppType::kWeb:
if (base::FeatureList::IsEnabled(
features::kDesktopPWAsWithoutExtensions)) {
// Web apps can only toggle between kStandalone and kBrowser.
web_app::DisplayMode user_display_mode =
ConvertUseLaunchTypeCommandToDisplayMode(command_id);
if (user_display_mode != web_app::DisplayMode::kUndefined) {
auto* provider = web_app::WebAppProvider::Get(profile());
DCHECK(provider);
provider->registry_controller().SetAppUserDisplayMode(
app_id(), user_display_mode);
}
return;
case apps::mojom::AppType::kWeb: {
// Web apps can only toggle between kStandalone and kBrowser.
web_app::DisplayMode user_display_mode =
ConvertUseLaunchTypeCommandToDisplayMode(command_id);
if (user_display_mode != web_app::DisplayMode::kUndefined) {
auto* provider = web_app::WebAppProvider::Get(profile());
DCHECK(provider);
provider->registry_controller().SetAppUserDisplayMode(
app_id(), user_display_mode);
}
// Otherwise deliberately fall through to fallback on Bookmark Apps.
FALLTHROUGH;
return;
}
case apps::mojom::AppType::kExtension: {
// Hosted apps can only toggle between LAUNCH_TYPE_WINDOW and
// LAUNCH_TYPE_REGULAR.
......
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