From d6d1a8e02c99b369fdbd9df2d3bdb68832f3d614 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Sun, 15 Nov 2020 09:00:19 -0500 Subject: [PATCH] applets/web: Implement the default web browser applet frontend --- src/core/frontend/applets/web_browser.cpp | 8 ++++++++ src/core/frontend/applets/web_browser.h | 12 ++++++++++++ src/core/hle/service/am/applets/web_browser.cpp | 5 ++++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/core/frontend/applets/web_browser.cpp b/src/core/frontend/applets/web_browser.cpp index 58861809ec..0e1612e272 100644 --- a/src/core/frontend/applets/web_browser.cpp +++ b/src/core/frontend/applets/web_browser.cpp @@ -11,4 +11,12 @@ WebBrowserApplet::~WebBrowserApplet() = default; DefaultWebBrowserApplet::~DefaultWebBrowserApplet() = default; +void DefaultWebBrowserApplet::OpenLocalWebPage( + std::string_view local_url, std::function callback) const { + LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to open local web page at {}", + local_url); + + callback(WebExitReason::WindowClosed, "http://localhost/"); +} + } // namespace Core::Frontend diff --git a/src/core/frontend/applets/web_browser.h b/src/core/frontend/applets/web_browser.h index 6e5f4d93dc..2ccefc68fc 100644 --- a/src/core/frontend/applets/web_browser.h +++ b/src/core/frontend/applets/web_browser.h @@ -5,17 +5,29 @@ #pragma once #include +#include + +#include "core/hle/service/am/applets/web_types.h" + +using namespace Service::AM::Applets; namespace Core::Frontend { class WebBrowserApplet { public: virtual ~WebBrowserApplet(); + + virtual void OpenLocalWebPage( + std::string_view local_url, + std::function callback) const = 0; }; class DefaultWebBrowserApplet final : public WebBrowserApplet { public: ~DefaultWebBrowserApplet() override; + + void OpenLocalWebPage(std::string_view local_url, + std::function callback) const override; }; } // namespace Core::Frontend diff --git a/src/core/hle/service/am/applets/web_browser.cpp b/src/core/hle/service/am/applets/web_browser.cpp index 06fcf3e3fe..c0c98ad30a 100644 --- a/src/core/hle/service/am/applets/web_browser.cpp +++ b/src/core/hle/service/am/applets/web_browser.cpp @@ -356,7 +356,10 @@ void WebBrowser::ExecuteLogin() { void WebBrowser::ExecuteOffline() { LOG_INFO(Service_AM, "Opening offline document at {}", offline_document); - WebBrowserExit(WebExitReason::WindowClosed); + frontend.OpenLocalWebPage(offline_document, + [this](WebExitReason exit_reason, std::string last_url) { + WebBrowserExit(exit_reason, last_url); + }); } void WebBrowser::ExecuteShare() {