diff options
Diffstat (limited to '')
-rw-r--r-- | src/core/frontend/applets/web_browser.cpp | 11 | ||||
-rw-r--r-- | src/core/frontend/applets/web_browser.h | 24 | ||||
-rw-r--r-- | src/yuzu/applets/qt_web_browser.cpp | 11 | ||||
-rw-r--r-- | src/yuzu/applets/qt_web_browser.h | 13 |
4 files changed, 27 insertions, 32 deletions
diff --git a/src/core/frontend/applets/web_browser.cpp b/src/core/frontend/applets/web_browser.cpp index 27c7086be..b09cb7102 100644 --- a/src/core/frontend/applets/web_browser.cpp +++ b/src/core/frontend/applets/web_browser.cpp @@ -10,18 +10,17 @@ WebBrowserApplet::~WebBrowserApplet() = default; DefaultWebBrowserApplet::~DefaultWebBrowserApplet() = default; -void DefaultWebBrowserApplet::OpenLocalWebPage( - const std::string& local_url, std::function<void()> extract_romfs_callback, - std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const { +void DefaultWebBrowserApplet::OpenLocalWebPage(const std::string& local_url, + ExtractROMFSCallback extract_romfs_callback, + OpenWebPageCallback callback) const { LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to open local web page at {}", local_url); callback(Service::AM::Applets::WebExitReason::WindowClosed, "http://localhost/"); } -void DefaultWebBrowserApplet::OpenExternalWebPage( - const std::string& external_url, - std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const { +void DefaultWebBrowserApplet::OpenExternalWebPage(const std::string& external_url, + OpenWebPageCallback callback) const { LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to open external web page at {}", external_url); diff --git a/src/core/frontend/applets/web_browser.h b/src/core/frontend/applets/web_browser.h index 1411274f8..4f72284ad 100644 --- a/src/core/frontend/applets/web_browser.h +++ b/src/core/frontend/applets/web_browser.h @@ -11,29 +11,29 @@ namespace Core::Frontend { class WebBrowserApplet { public: + using ExtractROMFSCallback = std::function<void()>; + using OpenWebPageCallback = + std::function<void(Service::AM::Applets::WebExitReason, std::string)>; + virtual ~WebBrowserApplet(); - virtual void OpenLocalWebPage( - const std::string& local_url, std::function<void()> extract_romfs_callback, - std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const = 0; + virtual void OpenLocalWebPage(const std::string& local_url, + ExtractROMFSCallback extract_romfs_callback, + OpenWebPageCallback callback) const = 0; - virtual void OpenExternalWebPage( - const std::string& external_url, - std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const = 0; + virtual void OpenExternalWebPage(const std::string& external_url, + OpenWebPageCallback callback) const = 0; }; class DefaultWebBrowserApplet final : public WebBrowserApplet { public: ~DefaultWebBrowserApplet() override; - void OpenLocalWebPage(const std::string& local_url, - std::function<void()> extract_romfs_callback, - std::function<void(Service::AM::Applets::WebExitReason, std::string)> - callback) const override; + void OpenLocalWebPage(const std::string& local_url, ExtractROMFSCallback extract_romfs_callback, + OpenWebPageCallback callback) const override; void OpenExternalWebPage(const std::string& external_url, - std::function<void(Service::AM::Applets::WebExitReason, std::string)> - callback) const override; + OpenWebPageCallback callback) const override; }; } // namespace Core::Frontend diff --git a/src/yuzu/applets/qt_web_browser.cpp b/src/yuzu/applets/qt_web_browser.cpp index 89bd482e0..0a5912326 100644 --- a/src/yuzu/applets/qt_web_browser.cpp +++ b/src/yuzu/applets/qt_web_browser.cpp @@ -401,9 +401,9 @@ QtWebBrowser::QtWebBrowser(GMainWindow& main_window) { QtWebBrowser::~QtWebBrowser() = default; -void QtWebBrowser::OpenLocalWebPage( - const std::string& local_url, std::function<void()> extract_romfs_callback_, - std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback_) const { +void QtWebBrowser::OpenLocalWebPage(const std::string& local_url, + ExtractROMFSCallback extract_romfs_callback_, + OpenWebPageCallback callback_) const { extract_romfs_callback = std::move(extract_romfs_callback_); callback = std::move(callback_); @@ -416,9 +416,8 @@ void QtWebBrowser::OpenLocalWebPage( } } -void QtWebBrowser::OpenExternalWebPage( - const std::string& external_url, - std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback_) const { +void QtWebBrowser::OpenExternalWebPage(const std::string& external_url, + OpenWebPageCallback callback_) const { callback = std::move(callback_); const auto index = external_url.find('?'); diff --git a/src/yuzu/applets/qt_web_browser.h b/src/yuzu/applets/qt_web_browser.h index 043800853..e8fe511ed 100644 --- a/src/yuzu/applets/qt_web_browser.h +++ b/src/yuzu/applets/qt_web_browser.h @@ -197,13 +197,11 @@ public: ~QtWebBrowser() override; void OpenLocalWebPage(const std::string& local_url, - std::function<void()> extract_romfs_callback_, - std::function<void(Service::AM::Applets::WebExitReason, std::string)> - callback_) const override; + ExtractROMFSCallback extract_romfs_callback_, + OpenWebPageCallback callback_) const override; void OpenExternalWebPage(const std::string& external_url, - std::function<void(Service::AM::Applets::WebExitReason, std::string)> - callback_) const override; + OpenWebPageCallback callback_) const override; signals: void MainWindowOpenWebPage(const std::string& main_url, const std::string& additional_args, @@ -215,7 +213,6 @@ private: void MainWindowWebBrowserClosed(Service::AM::Applets::WebExitReason exit_reason, std::string last_url); - mutable std::function<void()> extract_romfs_callback; - - mutable std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback; + mutable ExtractROMFSCallback extract_romfs_callback; + mutable OpenWebPageCallback callback; }; |