diff options
Diffstat (limited to 'src')
| -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; | |||
| 10 | 10 | ||
| 11 | DefaultWebBrowserApplet::~DefaultWebBrowserApplet() = default; | 11 | DefaultWebBrowserApplet::~DefaultWebBrowserApplet() = default; |
| 12 | 12 | ||
| 13 | void DefaultWebBrowserApplet::OpenLocalWebPage( | 13 | void DefaultWebBrowserApplet::OpenLocalWebPage(const std::string& local_url, |
| 14 | const std::string& local_url, std::function<void()> extract_romfs_callback, | 14 | ExtractROMFSCallback extract_romfs_callback, |
| 15 | std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const { | 15 | OpenWebPageCallback callback) const { |
| 16 | LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to open local web page at {}", | 16 | LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to open local web page at {}", |
| 17 | local_url); | 17 | local_url); |
| 18 | 18 | ||
| 19 | callback(Service::AM::Applets::WebExitReason::WindowClosed, "http://localhost/"); | 19 | callback(Service::AM::Applets::WebExitReason::WindowClosed, "http://localhost/"); |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | void DefaultWebBrowserApplet::OpenExternalWebPage( | 22 | void DefaultWebBrowserApplet::OpenExternalWebPage(const std::string& external_url, |
| 23 | const std::string& external_url, | 23 | OpenWebPageCallback callback) const { |
| 24 | std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const { | ||
| 25 | LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to open external web page at {}", | 24 | LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to open external web page at {}", |
| 26 | external_url); | 25 | external_url); |
| 27 | 26 | ||
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 { | |||
| 11 | 11 | ||
| 12 | class WebBrowserApplet { | 12 | class WebBrowserApplet { |
| 13 | public: | 13 | public: |
| 14 | using ExtractROMFSCallback = std::function<void()>; | ||
| 15 | using OpenWebPageCallback = | ||
| 16 | std::function<void(Service::AM::Applets::WebExitReason, std::string)>; | ||
| 17 | |||
| 14 | virtual ~WebBrowserApplet(); | 18 | virtual ~WebBrowserApplet(); |
| 15 | 19 | ||
| 16 | virtual void OpenLocalWebPage( | 20 | virtual void OpenLocalWebPage(const std::string& local_url, |
| 17 | const std::string& local_url, std::function<void()> extract_romfs_callback, | 21 | ExtractROMFSCallback extract_romfs_callback, |
| 18 | std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const = 0; | 22 | OpenWebPageCallback callback) const = 0; |
| 19 | 23 | ||
| 20 | virtual void OpenExternalWebPage( | 24 | virtual void OpenExternalWebPage(const std::string& external_url, |
| 21 | const std::string& external_url, | 25 | OpenWebPageCallback callback) const = 0; |
| 22 | std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const = 0; | ||
| 23 | }; | 26 | }; |
| 24 | 27 | ||
| 25 | class DefaultWebBrowserApplet final : public WebBrowserApplet { | 28 | class DefaultWebBrowserApplet final : public WebBrowserApplet { |
| 26 | public: | 29 | public: |
| 27 | ~DefaultWebBrowserApplet() override; | 30 | ~DefaultWebBrowserApplet() override; |
| 28 | 31 | ||
| 29 | void OpenLocalWebPage(const std::string& local_url, | 32 | void OpenLocalWebPage(const std::string& local_url, ExtractROMFSCallback extract_romfs_callback, |
| 30 | std::function<void()> extract_romfs_callback, | 33 | OpenWebPageCallback callback) const override; |
| 31 | std::function<void(Service::AM::Applets::WebExitReason, std::string)> | ||
| 32 | callback) const override; | ||
| 33 | 34 | ||
| 34 | void OpenExternalWebPage(const std::string& external_url, | 35 | void OpenExternalWebPage(const std::string& external_url, |
| 35 | std::function<void(Service::AM::Applets::WebExitReason, std::string)> | 36 | OpenWebPageCallback callback) const override; |
| 36 | callback) const override; | ||
| 37 | }; | 37 | }; |
| 38 | 38 | ||
| 39 | } // namespace Core::Frontend | 39 | } // 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) { | |||
| 401 | 401 | ||
| 402 | QtWebBrowser::~QtWebBrowser() = default; | 402 | QtWebBrowser::~QtWebBrowser() = default; |
| 403 | 403 | ||
| 404 | void QtWebBrowser::OpenLocalWebPage( | 404 | void QtWebBrowser::OpenLocalWebPage(const std::string& local_url, |
| 405 | const std::string& local_url, std::function<void()> extract_romfs_callback_, | 405 | ExtractROMFSCallback extract_romfs_callback_, |
| 406 | std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback_) const { | 406 | OpenWebPageCallback callback_) const { |
| 407 | extract_romfs_callback = std::move(extract_romfs_callback_); | 407 | extract_romfs_callback = std::move(extract_romfs_callback_); |
| 408 | callback = std::move(callback_); | 408 | callback = std::move(callback_); |
| 409 | 409 | ||
| @@ -416,9 +416,8 @@ void QtWebBrowser::OpenLocalWebPage( | |||
| 416 | } | 416 | } |
| 417 | } | 417 | } |
| 418 | 418 | ||
| 419 | void QtWebBrowser::OpenExternalWebPage( | 419 | void QtWebBrowser::OpenExternalWebPage(const std::string& external_url, |
| 420 | const std::string& external_url, | 420 | OpenWebPageCallback callback_) const { |
| 421 | std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback_) const { | ||
| 422 | callback = std::move(callback_); | 421 | callback = std::move(callback_); |
| 423 | 422 | ||
| 424 | const auto index = external_url.find('?'); | 423 | 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: | |||
| 197 | ~QtWebBrowser() override; | 197 | ~QtWebBrowser() override; |
| 198 | 198 | ||
| 199 | void OpenLocalWebPage(const std::string& local_url, | 199 | void OpenLocalWebPage(const std::string& local_url, |
| 200 | std::function<void()> extract_romfs_callback_, | 200 | ExtractROMFSCallback extract_romfs_callback_, |
| 201 | std::function<void(Service::AM::Applets::WebExitReason, std::string)> | 201 | OpenWebPageCallback callback_) const override; |
| 202 | callback_) const override; | ||
| 203 | 202 | ||
| 204 | void OpenExternalWebPage(const std::string& external_url, | 203 | void OpenExternalWebPage(const std::string& external_url, |
| 205 | std::function<void(Service::AM::Applets::WebExitReason, std::string)> | 204 | OpenWebPageCallback callback_) const override; |
| 206 | callback_) const override; | ||
| 207 | 205 | ||
| 208 | signals: | 206 | signals: |
| 209 | void MainWindowOpenWebPage(const std::string& main_url, const std::string& additional_args, | 207 | void MainWindowOpenWebPage(const std::string& main_url, const std::string& additional_args, |
| @@ -215,7 +213,6 @@ private: | |||
| 215 | void MainWindowWebBrowserClosed(Service::AM::Applets::WebExitReason exit_reason, | 213 | void MainWindowWebBrowserClosed(Service::AM::Applets::WebExitReason exit_reason, |
| 216 | std::string last_url); | 214 | std::string last_url); |
| 217 | 215 | ||
| 218 | mutable std::function<void()> extract_romfs_callback; | 216 | mutable ExtractROMFSCallback extract_romfs_callback; |
| 219 | 217 | mutable OpenWebPageCallback callback; | |
| 220 | mutable std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback; | ||
| 221 | }; | 218 | }; |