diff options
| author | 2020-12-21 23:47:10 -0800 | |
|---|---|---|
| committer | 2020-12-21 23:47:10 -0800 | |
| commit | 29ccc7673fc10dee39880fd7bad0ff264765dd56 (patch) | |
| tree | 234c2a3fca543e580480ed72e37c1ee9f201aa93 /src/core/frontend/applets | |
| parent | Merge pull request #5131 from bunnei/scheduler-rewrite (diff) | |
| parent | applets/web: Implement the online web browser applet (diff) | |
| download | yuzu-29ccc7673fc10dee39880fd7bad0ff264765dd56.tar.gz yuzu-29ccc7673fc10dee39880fd7bad0ff264765dd56.tar.xz yuzu-29ccc7673fc10dee39880fd7bad0ff264765dd56.zip | |
Merge pull request #5042 from Morph1984/project-aether
Project Aether: Reimplementation of the Web Browser Applet
Diffstat (limited to 'src/core/frontend/applets')
| -rw-r--r-- | src/core/frontend/applets/general_frontend.cpp | 68 | ||||
| -rw-r--r-- | src/core/frontend/applets/general_frontend.h | 51 | ||||
| -rw-r--r-- | src/core/frontend/applets/web_browser.cpp | 24 | ||||
| -rw-r--r-- | src/core/frontend/applets/web_browser.h | 20 |
4 files changed, 32 insertions, 131 deletions
diff --git a/src/core/frontend/applets/general_frontend.cpp b/src/core/frontend/applets/general_frontend.cpp index c30b36de7..7483ffb76 100644 --- a/src/core/frontend/applets/general_frontend.cpp +++ b/src/core/frontend/applets/general_frontend.cpp | |||
| @@ -53,72 +53,4 @@ void DefaultPhotoViewerApplet::ShowAllPhotos(std::function<void()> finished) con | |||
| 53 | finished(); | 53 | finished(); |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | ECommerceApplet::~ECommerceApplet() = default; | ||
| 57 | |||
| 58 | DefaultECommerceApplet::~DefaultECommerceApplet() = default; | ||
| 59 | |||
| 60 | void DefaultECommerceApplet::ShowApplicationInformation( | ||
| 61 | std::function<void()> finished, u64 title_id, std::optional<u128> user_id, | ||
| 62 | std::optional<bool> full_display, std::optional<std::string> extra_parameter) { | ||
| 63 | const auto value = user_id.value_or(u128{}); | ||
| 64 | LOG_INFO(Service_AM, | ||
| 65 | "Application requested frontend show application information for EShop, " | ||
| 66 | "title_id={:016X}, user_id={:016X}{:016X}, full_display={}, extra_parameter={}", | ||
| 67 | title_id, value[1], value[0], | ||
| 68 | full_display.has_value() ? fmt::format("{}", *full_display) : "null", | ||
| 69 | extra_parameter.value_or("null")); | ||
| 70 | finished(); | ||
| 71 | } | ||
| 72 | |||
| 73 | void DefaultECommerceApplet::ShowAddOnContentList(std::function<void()> finished, u64 title_id, | ||
| 74 | std::optional<u128> user_id, | ||
| 75 | std::optional<bool> full_display) { | ||
| 76 | const auto value = user_id.value_or(u128{}); | ||
| 77 | LOG_INFO(Service_AM, | ||
| 78 | "Application requested frontend show add on content list for EShop, " | ||
| 79 | "title_id={:016X}, user_id={:016X}{:016X}, full_display={}", | ||
| 80 | title_id, value[1], value[0], | ||
| 81 | full_display.has_value() ? fmt::format("{}", *full_display) : "null"); | ||
| 82 | finished(); | ||
| 83 | } | ||
| 84 | |||
| 85 | void DefaultECommerceApplet::ShowSubscriptionList(std::function<void()> finished, u64 title_id, | ||
| 86 | std::optional<u128> user_id) { | ||
| 87 | const auto value = user_id.value_or(u128{}); | ||
| 88 | LOG_INFO(Service_AM, | ||
| 89 | "Application requested frontend show subscription list for EShop, title_id={:016X}, " | ||
| 90 | "user_id={:016X}{:016X}", | ||
| 91 | title_id, value[1], value[0]); | ||
| 92 | finished(); | ||
| 93 | } | ||
| 94 | |||
| 95 | void DefaultECommerceApplet::ShowConsumableItemList(std::function<void()> finished, u64 title_id, | ||
| 96 | std::optional<u128> user_id) { | ||
| 97 | const auto value = user_id.value_or(u128{}); | ||
| 98 | LOG_INFO( | ||
| 99 | Service_AM, | ||
| 100 | "Application requested frontend show consumable item list for EShop, title_id={:016X}, " | ||
| 101 | "user_id={:016X}{:016X}", | ||
| 102 | title_id, value[1], value[0]); | ||
| 103 | finished(); | ||
| 104 | } | ||
| 105 | |||
| 106 | void DefaultECommerceApplet::ShowShopHome(std::function<void()> finished, u128 user_id, | ||
| 107 | bool full_display) { | ||
| 108 | LOG_INFO(Service_AM, | ||
| 109 | "Application requested frontend show home menu for EShop, user_id={:016X}{:016X}, " | ||
| 110 | "full_display={}", | ||
| 111 | user_id[1], user_id[0], full_display); | ||
| 112 | finished(); | ||
| 113 | } | ||
| 114 | |||
| 115 | void DefaultECommerceApplet::ShowSettings(std::function<void()> finished, u128 user_id, | ||
| 116 | bool full_display) { | ||
| 117 | LOG_INFO(Service_AM, | ||
| 118 | "Application requested frontend show settings menu for EShop, user_id={:016X}{:016X}, " | ||
| 119 | "full_display={}", | ||
| 120 | user_id[1], user_id[0], full_display); | ||
| 121 | finished(); | ||
| 122 | } | ||
| 123 | |||
| 124 | } // namespace Core::Frontend | 56 | } // namespace Core::Frontend |
diff --git a/src/core/frontend/applets/general_frontend.h b/src/core/frontend/applets/general_frontend.h index 4b63f828e..b713b14ee 100644 --- a/src/core/frontend/applets/general_frontend.h +++ b/src/core/frontend/applets/general_frontend.h | |||
| @@ -58,55 +58,4 @@ public: | |||
| 58 | void ShowAllPhotos(std::function<void()> finished) const override; | 58 | void ShowAllPhotos(std::function<void()> finished) const override; |
| 59 | }; | 59 | }; |
| 60 | 60 | ||
| 61 | class ECommerceApplet { | ||
| 62 | public: | ||
| 63 | virtual ~ECommerceApplet(); | ||
| 64 | |||
| 65 | // Shows a page with application icons, description, name, and price. | ||
| 66 | virtual void ShowApplicationInformation(std::function<void()> finished, u64 title_id, | ||
| 67 | std::optional<u128> user_id = {}, | ||
| 68 | std::optional<bool> full_display = {}, | ||
| 69 | std::optional<std::string> extra_parameter = {}) = 0; | ||
| 70 | |||
| 71 | // Shows a page with all of the add on content available for a game, with name, description, and | ||
| 72 | // price. | ||
| 73 | virtual void ShowAddOnContentList(std::function<void()> finished, u64 title_id, | ||
| 74 | std::optional<u128> user_id = {}, | ||
| 75 | std::optional<bool> full_display = {}) = 0; | ||
| 76 | |||
| 77 | // Shows a page with all of the subscriptions (recurring payments) for a game, with name, | ||
| 78 | // description, price, and renewal period. | ||
| 79 | virtual void ShowSubscriptionList(std::function<void()> finished, u64 title_id, | ||
| 80 | std::optional<u128> user_id = {}) = 0; | ||
| 81 | |||
| 82 | // Shows a page with a list of any additional game related purchasable items (DLC, | ||
| 83 | // subscriptions, etc) for a particular game, with name, description, type, and price. | ||
| 84 | virtual void ShowConsumableItemList(std::function<void()> finished, u64 title_id, | ||
| 85 | std::optional<u128> user_id = {}) = 0; | ||
| 86 | |||
| 87 | // Shows the home page of the shop. | ||
| 88 | virtual void ShowShopHome(std::function<void()> finished, u128 user_id, bool full_display) = 0; | ||
| 89 | |||
| 90 | // Shows the user settings page of the shop. | ||
| 91 | virtual void ShowSettings(std::function<void()> finished, u128 user_id, bool full_display) = 0; | ||
| 92 | }; | ||
| 93 | |||
| 94 | class DefaultECommerceApplet : public ECommerceApplet { | ||
| 95 | public: | ||
| 96 | ~DefaultECommerceApplet() override; | ||
| 97 | |||
| 98 | void ShowApplicationInformation(std::function<void()> finished, u64 title_id, | ||
| 99 | std::optional<u128> user_id, std::optional<bool> full_display, | ||
| 100 | std::optional<std::string> extra_parameter) override; | ||
| 101 | void ShowAddOnContentList(std::function<void()> finished, u64 title_id, | ||
| 102 | std::optional<u128> user_id, | ||
| 103 | std::optional<bool> full_display) override; | ||
| 104 | void ShowSubscriptionList(std::function<void()> finished, u64 title_id, | ||
| 105 | std::optional<u128> user_id) override; | ||
| 106 | void ShowConsumableItemList(std::function<void()> finished, u64 title_id, | ||
| 107 | std::optional<u128> user_id) override; | ||
| 108 | void ShowShopHome(std::function<void()> finished, u128 user_id, bool full_display) override; | ||
| 109 | void ShowSettings(std::function<void()> finished, u128 user_id, bool full_display) override; | ||
| 110 | }; | ||
| 111 | |||
| 112 | } // namespace Core::Frontend | 61 | } // namespace Core::Frontend |
diff --git a/src/core/frontend/applets/web_browser.cpp b/src/core/frontend/applets/web_browser.cpp index 528295ffc..50db6a654 100644 --- a/src/core/frontend/applets/web_browser.cpp +++ b/src/core/frontend/applets/web_browser.cpp | |||
| @@ -11,14 +11,22 @@ WebBrowserApplet::~WebBrowserApplet() = default; | |||
| 11 | 11 | ||
| 12 | DefaultWebBrowserApplet::~DefaultWebBrowserApplet() = default; | 12 | DefaultWebBrowserApplet::~DefaultWebBrowserApplet() = default; |
| 13 | 13 | ||
| 14 | void DefaultWebBrowserApplet::OpenPageLocal(std::string_view filename, | 14 | void DefaultWebBrowserApplet::OpenLocalWebPage( |
| 15 | std::function<void()> unpack_romfs_callback, | 15 | std::string_view local_url, std::function<void()> extract_romfs_callback, |
| 16 | std::function<void()> finished_callback) { | 16 | std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const { |
| 17 | LOG_INFO(Service_AM, | 17 | LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to open local web page at {}", |
| 18 | "(STUBBED) called - No suitable web browser implementation found to open website page " | 18 | local_url); |
| 19 | "at '{}'!", | 19 | |
| 20 | filename); | 20 | callback(Service::AM::Applets::WebExitReason::WindowClosed, "http://localhost/"); |
| 21 | finished_callback(); | 21 | } |
| 22 | |||
| 23 | void DefaultWebBrowserApplet::OpenExternalWebPage( | ||
| 24 | std::string_view external_url, | ||
| 25 | std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const { | ||
| 26 | LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to open external web page at {}", | ||
| 27 | external_url); | ||
| 28 | |||
| 29 | callback(Service::AM::Applets::WebExitReason::WindowClosed, "http://localhost/"); | ||
| 22 | } | 30 | } |
| 23 | 31 | ||
| 24 | } // namespace Core::Frontend | 32 | } // namespace Core::Frontend |
diff --git a/src/core/frontend/applets/web_browser.h b/src/core/frontend/applets/web_browser.h index 110e33bc4..1c5ef19a9 100644 --- a/src/core/frontend/applets/web_browser.h +++ b/src/core/frontend/applets/web_browser.h | |||
| @@ -7,22 +7,34 @@ | |||
| 7 | #include <functional> | 7 | #include <functional> |
| 8 | #include <string_view> | 8 | #include <string_view> |
| 9 | 9 | ||
| 10 | #include "core/hle/service/am/applets/web_types.h" | ||
| 11 | |||
| 10 | namespace Core::Frontend { | 12 | namespace Core::Frontend { |
| 11 | 13 | ||
| 12 | class WebBrowserApplet { | 14 | class WebBrowserApplet { |
| 13 | public: | 15 | public: |
| 14 | virtual ~WebBrowserApplet(); | 16 | virtual ~WebBrowserApplet(); |
| 15 | 17 | ||
| 16 | virtual void OpenPageLocal(std::string_view url, std::function<void()> unpack_romfs_callback, | 18 | virtual void OpenLocalWebPage( |
| 17 | std::function<void()> finished_callback) = 0; | 19 | std::string_view local_url, std::function<void()> extract_romfs_callback, |
| 20 | std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const = 0; | ||
| 21 | |||
| 22 | virtual void OpenExternalWebPage( | ||
| 23 | std::string_view external_url, | ||
| 24 | std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const = 0; | ||
| 18 | }; | 25 | }; |
| 19 | 26 | ||
| 20 | class DefaultWebBrowserApplet final : public WebBrowserApplet { | 27 | class DefaultWebBrowserApplet final : public WebBrowserApplet { |
| 21 | public: | 28 | public: |
| 22 | ~DefaultWebBrowserApplet() override; | 29 | ~DefaultWebBrowserApplet() override; |
| 23 | 30 | ||
| 24 | void OpenPageLocal(std::string_view url, std::function<void()> unpack_romfs_callback, | 31 | void OpenLocalWebPage(std::string_view local_url, std::function<void()> extract_romfs_callback, |
| 25 | std::function<void()> finished_callback) override; | 32 | std::function<void(Service::AM::Applets::WebExitReason, std::string)> |
| 33 | callback) const override; | ||
| 34 | |||
| 35 | void OpenExternalWebPage(std::string_view external_url, | ||
| 36 | std::function<void(Service::AM::Applets::WebExitReason, std::string)> | ||
| 37 | callback) const override; | ||
| 26 | }; | 38 | }; |
| 27 | 39 | ||
| 28 | } // namespace Core::Frontend | 40 | } // namespace Core::Frontend |