Commit bd43fdca authored by nancy's avatar nancy Committed by Commit Bot

Modify WebApps to remove the dependency on LaunchService

Modify WebApps to call WebAppLaunchManager API OpenApplication directly
to launch apps.

BUG=1061843

Change-Id: I5f5e165929b31f9cc55a5f0d466a30a24b8fbaf6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2115251
Commit-Queue: Nancy Wang <nancylingwang@chromium.org>
Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#752746}
parent 71ab5ffe
......@@ -4,7 +4,6 @@
#include "chrome/browser/apps/app_service/web_apps.h"
#include <memory>
#include <utility>
#include <vector>
......@@ -33,6 +32,7 @@
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/web_applications/web_app_dialog_manager.h"
#include "chrome/browser/ui/web_applications/web_app_launch_manager.h"
#include "chrome/browser/ui/web_applications/web_app_ui_manager_impl.h"
#include "chrome/browser/web_applications/components/install_finalizer.h"
#include "chrome/browser/web_applications/components/web_app_constants.h"
......@@ -167,6 +167,9 @@ void WebApps::Initialize(
content_settings_observer_.Add(
HostContentSettingsMapFactory::GetForProfile(profile_));
web_app_launch_manager_ =
std::make_unique<web_app::WebAppLaunchManager>(profile_);
app_service->RegisterPublisher(receiver_.BindNewPipeAndPassRemote(),
apps::mojom::AppType::kWeb);
app_service_ = app_service.get();
......@@ -240,7 +243,7 @@ void WebApps::Launch(const std::string& app_id,
web_app::ConvertDisplayModeToAppLaunchContainer(display_mode));
// The app will be created for the currently active profile.
apps::LaunchService::Get(profile_)->OpenApplication(params);
web_app_launch_manager_->OpenApplication(params);
}
void WebApps::LaunchAppWithIntent(const std::string& app_id,
......@@ -252,8 +255,7 @@ void WebApps::LaunchAppWithIntent(const std::string& app_id,
}
AppLaunchParams params = CreateAppLaunchParamsForIntent(app_id, intent);
apps::LaunchService::Get(profile_)->OpenApplication(params);
web_app_launch_manager_->OpenApplication(params);
}
void WebApps::SetPermission(const std::string& app_id,
......
......@@ -5,6 +5,7 @@
#ifndef CHROME_BROWSER_APPS_APP_SERVICE_WEB_APPS_H_
#define CHROME_BROWSER_APPS_APP_SERVICE_WEB_APPS_H_
#include <memory>
#include <string>
#include "base/memory/weak_ptr.h"
......@@ -30,6 +31,7 @@ class Profile;
namespace web_app {
class WebApp;
class WebAppLaunchManager;
class WebAppProvider;
class WebAppRegistrar;
} // namespace web_app
......@@ -162,6 +164,8 @@ class WebApps : public apps::mojom::Publisher,
web_app::WebAppProvider* provider_ = nullptr;
std::unique_ptr<web_app::WebAppLaunchManager> web_app_launch_manager_;
ArcAppListPrefs* arc_prefs_ = nullptr;
// app_service_ is owned by the object that owns this object.
......
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