Commit 18b7526e authored by nancy's avatar nancy Committed by Commit Bot

Update Shelf LaunchApp to use AppService to launch apps.

BUG=1002351

Change-Id: I8df9f7f59599d5874c7170555a285b46141bb125
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1803035Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Nancy Wang <nancylingwang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#697054}
parent 6e0bf089
......@@ -244,6 +244,9 @@ void ArcApps::Launch(const std::string& app_id,
case apps::mojom::LaunchSource::kFromParentalControls:
uit = arc::UserInteractionType::APP_STARTED_FROM_SETTINGS;
break;
case apps::mojom::LaunchSource::kFromShelf:
uit = arc::UserInteractionType::APP_STARTED_FROM_SHELF;
break;
}
arc::LaunchApp(profile_, app_id, event_flags, uit, display_id);
......
......@@ -157,6 +157,7 @@ void BuiltInChromeOsApps::Launch(const std::string& app_id,
switch (launch_source) {
case apps::mojom::LaunchSource::kUnknown:
case apps::mojom::LaunchSource::kFromParentalControls:
case apps::mojom::LaunchSource::kFromShelf:
break;
case apps::mojom::LaunchSource::kFromAppListGrid:
case apps::mojom::LaunchSource::kFromAppListGridContextMenu:
......
......@@ -94,6 +94,8 @@ ash::ShelfLaunchSource ConvertLaunchSource(
case apps::mojom::LaunchSource::kFromAppListQueryContextMenu:
case apps::mojom::LaunchSource::kFromAppListRecommendation:
return ash::LAUNCH_FROM_APP_LIST_SEARCH;
case apps::mojom::LaunchSource::kFromShelf:
return ash::LAUNCH_FROM_SHELF;
}
}
......@@ -255,6 +257,7 @@ void ExtensionApps::Launch(const std::string& app_id,
extensions::RecordAppListSearchLaunch(extension);
break;
case apps::mojom::LaunchSource::kFromAppListRecommendation:
case apps::mojom::LaunchSource::kFromShelf:
break;
}
......
......@@ -22,6 +22,8 @@ ash::ShelfLaunchSource ConvertLaunchSource(
case apps::mojom::LaunchSource::kFromAppListQueryContextMenu:
case apps::mojom::LaunchSource::kFromAppListRecommendation:
return ash::LAUNCH_FROM_APP_LIST_SEARCH;
case apps::mojom::LaunchSource::kFromShelf:
return ash::LAUNCH_FROM_SHELF;
}
}
......
......@@ -7,6 +7,8 @@
#include <vector>
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/apps/app_service/app_service_proxy.h"
#include "chrome/browser/apps/app_service/app_service_proxy_factory.h"
#include "chrome/browser/apps/launch_service/launch_service.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/arc/arc_session_manager.h"
......@@ -30,6 +32,7 @@
#include "chrome/browser/ui/extensions/extension_enable_flow.h"
#include "chrome/browser/web_applications/components/web_app_helpers.h"
#include "chrome/browser/web_applications/extensions/bookmark_app_util.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
#include "components/arc/arc_util.h"
#include "components/arc/metrics/arc_metrics_constants.h"
......@@ -211,6 +214,15 @@ void LauncherControllerHelper::LaunchApp(const ash::ShelfID& id,
}
const std::string& app_id = id.app_id;
if (base::FeatureList::IsEnabled(features::kAppServiceShelf)) {
apps::AppServiceProxy* proxy =
apps::AppServiceProxyFactory::GetForProfile(profile_);
DCHECK(proxy);
proxy->Launch(app_id, event_flags, apps::mojom::LaunchSource::kFromShelf,
display_id);
return;
}
const ArcAppListPrefs* arc_prefs = GetArcAppListPrefs();
if (arc_prefs && arc_prefs->IsRegistered(app_id)) {
arc::LaunchApp(profile_, app_id, event_flags,
......
......@@ -161,6 +161,7 @@ enum LaunchSource {
kFromAppListQueryContextMenu, // Query-dependent results; context menu.
kFromAppListRecommendation, // Query-less recommendations (smaller icons).
kFromParentalControls, // Parental Controls Settings Section.
kFromShelf, // Shelf.
};
enum TriState {
......
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