#ifndef CHROME_BROWSER_DEVTOOLS_PROTOCOL_PWA_HANDLER_H_
#define CHROME_BROWSER_DEVTOOLS_PROTOCOL_PWA_HANDLER_H_
#include <memory>
#include <string>
#include "base/memory/weak_ptr.h"
#include "chrome/browser/devtools/protocol/pwa.h"
#include "url/gurl.h"
class Profile;
namespace content {
class WebContents;
}
namespace web_app {
class WebAppCommandScheduler;
struct WebAppInstallInfo;
}
class PWAHandler final : public protocol::PWA::Backend {
public:
explicit PWAHandler(protocol::UberDispatcher* dispatcher,
const std::string& target_id);
PWAHandler(const PWAHandler&) = delete;
PWAHandler& operator=(const PWAHandler&) = delete;
~PWAHandler() override;
private:
void GetOsAppState(const std::string& in_manifest_id,
std::unique_ptr<GetOsAppStateCallback> callback) override;
void Install(const std::string& in_manifest_id,
std::optional<std::string> in_install_url_or_bundle_url,
std::unique_ptr<InstallCallback> callback) override;
void Uninstall(const std::string& in_manifest_id,
std::unique_ptr<UninstallCallback> callback) override;
void Launch(const std::string& in_manifest_id,
std::optional<std::string> in_url,
std::unique_ptr<LaunchCallback> callback) override;
void LaunchFilesInApp(
const std::string& in_manifest_id,
std::unique_ptr<protocol::Array<std::string>> in_files,
std::unique_ptr<LaunchFilesInAppCallback> callback) override;
protocol::Response OpenCurrentPageInApp(
const std::string& in_manifest_id) override;
void ChangeAppUserSettings(
const std::string& in_manifest_id,
std::optional<bool> in_link_capturing,
std::optional<protocol::PWA::DisplayMode> in_display_mode,
std::unique_ptr<ChangeAppUserSettingsCallback> callback) override;
void InstallFromManifestId(const std::string& in_manifest_id,
std::unique_ptr<InstallCallback> callback);
void InstallFromUrl(const std::string& in_manifest_id,
const std::string& in_install_url_or_bundle_url,
std::unique_ptr<InstallCallback> callback);
void InstallWebBundleFromUrl(const GURL& manifest_url,
const GURL& web_bundle_url,
std::unique_ptr<InstallCallback> callback);
void InstallFromInstallInfo(
const std::string& in_manifest_id,
const std::string& in_install_url_or_bundle_url,
std::unique_ptr<InstallCallback> callback,
std::unique_ptr<web_app::WebAppInstallInfo> web_app_info);
Profile* GetProfile() const;
web_app::WebAppCommandScheduler* GetScheduler() const;
content::WebContents* GetWebContents() const;
const std::string target_id_;
base::WeakPtrFactory<PWAHandler> weak_ptr_factory_{this};
};
#endif