2022-04-23 01:59:50 -07:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2018-12-24 13:21:41 -08:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <functional>
|
2020-11-15 06:00:19 -08:00
|
|
|
|
2023-03-25 10:29:08 -07:00
|
|
|
#include "core/frontend/applets/applet.h"
|
2021-07-13 21:38:24 -07:00
|
|
|
#include "core/hle/service/am/applets/applet_web_browser_types.h"
|
2020-11-15 06:00:19 -08:00
|
|
|
|
2018-12-24 13:21:41 -08:00
|
|
|
namespace Core::Frontend {
|
|
|
|
|
2023-03-25 10:29:08 -07:00
|
|
|
class WebBrowserApplet : public Applet {
|
2018-12-24 13:21:41 -08:00
|
|
|
public:
|
2022-12-05 15:46:57 -08:00
|
|
|
using ExtractROMFSCallback = std::function<void()>;
|
|
|
|
using OpenWebPageCallback =
|
|
|
|
std::function<void(Service::AM::Applets::WebExitReason, std::string)>;
|
|
|
|
|
2018-12-24 13:21:41 -08:00
|
|
|
virtual ~WebBrowserApplet();
|
2020-11-15 06:00:19 -08:00
|
|
|
|
2022-12-05 15:46:57 -08:00
|
|
|
virtual void OpenLocalWebPage(const std::string& local_url,
|
|
|
|
ExtractROMFSCallback extract_romfs_callback,
|
|
|
|
OpenWebPageCallback callback) const = 0;
|
2020-12-08 03:20:45 -08:00
|
|
|
|
2022-12-05 15:46:57 -08:00
|
|
|
virtual void OpenExternalWebPage(const std::string& external_url,
|
|
|
|
OpenWebPageCallback callback) const = 0;
|
2018-12-24 13:21:41 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
class DefaultWebBrowserApplet final : public WebBrowserApplet {
|
|
|
|
public:
|
|
|
|
~DefaultWebBrowserApplet() override;
|
2020-11-15 06:00:19 -08:00
|
|
|
|
2023-03-25 10:29:08 -07:00
|
|
|
void Close() const override;
|
|
|
|
|
2022-12-05 15:46:57 -08:00
|
|
|
void OpenLocalWebPage(const std::string& local_url, ExtractROMFSCallback extract_romfs_callback,
|
|
|
|
OpenWebPageCallback callback) const override;
|
2020-12-08 03:20:45 -08:00
|
|
|
|
2021-04-28 08:32:44 -07:00
|
|
|
void OpenExternalWebPage(const std::string& external_url,
|
2022-12-05 15:46:57 -08:00
|
|
|
OpenWebPageCallback callback) const override;
|
2018-12-24 13:21:41 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Core::Frontend
|