Commit 41c70260 authored by nancy's avatar nancy Committed by Commit Bot

Use ChromeLauncherController's ActivateApp to activate apps.

Similar with AppServiceAppResult, AppServiceAppItem should use
ChromeLauncherController's ActivateApp to activate apps, the same as
ExtensionAppItem:
https://cs.chromium.org/chromium/src/chrome/browser/ui/app_list/extension_app_item.cc?q=ActivateApp&l=155&dr=C

BUG=1026730

Change-Id: I28fd19df903422092052c1a33cb42682bbcf6560
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1933856Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Nancy Wang <nancylingwang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#718890}
parent f028ebd0
......@@ -104,9 +104,28 @@ void AppServiceAppItem::OnAppUpdate(const apps::AppUpdate& app_update,
}
void AppServiceAppItem::Activate(int event_flags) {
// For Chrome apps or Web apps, if it is non-platform app, it could be
// selecting an existing delegate for the app, so call
// ChromeLauncherController's ActivateApp interface. Platform apps or ARC
// apps, Crostini apps treat activations as a launch. The app can decide
// whether to show a new window or focus an existing window as it sees fit.
//
// TODO(crbug.com/1022541): Move the Chrome special case to ExtensionApps,
// when AppService Instance feature is done.
if (id() == extension_misc::kChromeAppId) {
apps::AppServiceProxy* proxy =
apps::AppServiceProxyFactory::GetForProfile(profile());
if (!proxy)
return;
bool is_active_app = false;
proxy->AppRegistryCache().ForOneApp(
id(), [&is_active_app](const apps::AppUpdate& update) {
if ((update.AppType() == apps::mojom::AppType::kExtension ||
update.AppType() == apps::mojom::AppType::kWeb) &&
update.IsPlatformApp() == apps::mojom::OptionalBool::kFalse) {
is_active_app = true;
}
});
if (is_active_app) {
ChromeLauncherController::instance()->ActivateApp(
id(), ash::LAUNCH_FROM_APP_LIST, event_flags,
GetController()->GetAppListDisplayId());
......
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