Commit fb5942dd authored by Maggie Cai's avatar Maggie Cai Committed by Commit Bot

[IntentHandling] Launch PWA with intent in the App Service.

This CL adds PWA implementation for |LaunchAppWithIntent|.

BUG=853604

Change-Id: I6257f8d473d1368f0e769b1cca332cc72808bf23
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1851628
Commit-Queue: Maggie Cai <mxcai@chromium.org>
Reviewed-by: default avatarEric Willigers <ericwilligers@chromium.org>
Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#705806}
parent b308c1a3
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
#include "extensions/browser/extension_system.h" #include "extensions/browser/extension_system.h"
#include "extensions/common/constants.h" #include "extensions/common/constants.h"
#include "extensions/common/switches.h" #include "extensions/common/switches.h"
#include "url/url_constants.h"
// TODO(crbug.com/826982): life cycle events. Extensions can be installed and // TODO(crbug.com/826982): life cycle events. Extensions can be installed and
// uninstalled. ExtensionApps should implement extensions::InstallObserver and // uninstalled. ExtensionApps should implement extensions::InstallObserver and
...@@ -101,6 +102,26 @@ ash::ShelfLaunchSource ConvertLaunchSource( ...@@ -101,6 +102,26 @@ ash::ShelfLaunchSource ConvertLaunchSource(
return ash::LAUNCH_FROM_UNKNOWN; return ash::LAUNCH_FROM_UNKNOWN;
} }
} }
apps::AppLaunchParams CreateAppLaunchParamsForIntent(
const std::string& app_id,
const apps::mojom::IntentPtr& intent) {
apps::AppLaunchParams params(
app_id, apps::mojom::LaunchContainer::kLaunchContainerWindow,
WindowOpenDisposition::NEW_FOREGROUND_TAB,
apps::mojom::AppLaunchSource::kSourceNone);
if (intent->scheme.has_value() && intent->host.has_value() &&
intent->path.has_value()) {
params.source = apps::mojom::AppLaunchSource::kSourceIntentUrl;
params.override_url =
GURL(intent->scheme.value() + url::kStandardSchemeSeparator +
intent->host.value() + intent->path.value());
DCHECK(params.override_url.is_valid());
}
return params;
}
} // namespace } // namespace
namespace apps { namespace apps {
...@@ -325,7 +346,13 @@ void ExtensionApps::LaunchAppWithIntent(const std::string& app_id, ...@@ -325,7 +346,13 @@ void ExtensionApps::LaunchAppWithIntent(const std::string& app_id,
apps::mojom::IntentPtr intent, apps::mojom::IntentPtr intent,
apps::mojom::LaunchSource launch_source, apps::mojom::LaunchSource launch_source,
int64_t display_id) { int64_t display_id) {
NOTIMPLEMENTED(); if (!profile_) {
return;
}
AppLaunchParams params = CreateAppLaunchParamsForIntent(app_id, intent);
apps::LaunchService::Get(profile_)->OpenApplication(params);
} }
void ExtensionApps::SetPermission(const std::string& app_id, void ExtensionApps::SetPermission(const std::string& app_id,
......
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