2020-06-17 17:31:42 +02:00
|
|
|
/*
|
2021-02-10 08:48:28 +01:00
|
|
|
* Copyright (c) 2020-2021, Andreas Kling <kling@serenityos.org>
|
2020-06-17 17:31:42 +02:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are met:
|
|
|
|
*
|
|
|
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
|
|
* list of conditions and the following disclaimer.
|
|
|
|
*
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
* this list of conditions and the following disclaimer in the documentation
|
|
|
|
* and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
|
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
|
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
|
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/HashMap.h>
|
|
|
|
#include <LibIPC/ServerConnection.h>
|
2021-04-15 10:36:20 -04:00
|
|
|
#include <LibWeb/Cookie/ParsedCookie.h>
|
2020-06-17 17:31:42 +02:00
|
|
|
#include <WebContent/WebContentClientEndpoint.h>
|
|
|
|
#include <WebContent/WebContentServerEndpoint.h>
|
|
|
|
|
2020-08-24 15:33:18 +04:30
|
|
|
namespace Web {
|
|
|
|
|
2020-08-17 16:20:47 +02:00
|
|
|
class OutOfProcessWebView;
|
2020-06-17 17:31:42 +02:00
|
|
|
|
2021-01-30 18:20:40 +01:00
|
|
|
class WebContentClient final
|
2020-06-17 17:31:42 +02:00
|
|
|
: public IPC::ServerConnection<WebContentClientEndpoint, WebContentServerEndpoint>
|
|
|
|
, public WebContentClientEndpoint {
|
|
|
|
C_OBJECT(WebContentClient);
|
|
|
|
|
|
|
|
public:
|
|
|
|
virtual void handshake() override;
|
|
|
|
|
2021-01-30 18:20:40 +01:00
|
|
|
Function<void()> on_web_content_process_crash;
|
|
|
|
|
2020-06-17 17:31:42 +02:00
|
|
|
private:
|
2020-08-17 16:20:47 +02:00
|
|
|
WebContentClient(OutOfProcessWebView&);
|
2020-06-17 17:31:42 +02:00
|
|
|
|
2021-01-30 18:20:40 +01:00
|
|
|
virtual void die() override;
|
|
|
|
|
2020-06-17 17:31:42 +02:00
|
|
|
virtual void handle(const Messages::WebContentClient::DidPaint&) override;
|
2020-12-08 21:44:42 +01:00
|
|
|
virtual void handle(const Messages::WebContentClient::DidFinishLoading&) override;
|
2020-06-17 18:00:18 +02:00
|
|
|
virtual void handle(const Messages::WebContentClient::DidInvalidateContentRect&) override;
|
2020-07-04 20:57:57 +02:00
|
|
|
virtual void handle(const Messages::WebContentClient::DidChangeSelection&) override;
|
2021-02-27 21:12:12 +00:00
|
|
|
virtual void handle(const Messages::WebContentClient::DidRequestCursorChange&) override;
|
2020-07-04 23:19:32 +02:00
|
|
|
virtual void handle(const Messages::WebContentClient::DidLayout&) override;
|
2020-07-04 23:40:17 +02:00
|
|
|
virtual void handle(const Messages::WebContentClient::DidChangeTitle&) override;
|
2021-03-02 08:39:07 +11:00
|
|
|
virtual void handle(const Messages::WebContentClient::DidRequestScroll&) override;
|
2020-07-05 15:43:43 +02:00
|
|
|
virtual void handle(const Messages::WebContentClient::DidRequestScrollIntoView&) override;
|
2021-03-30 12:10:06 -04:00
|
|
|
virtual void handle(const Messages::WebContentClient::DidEnterTooltipArea&) override;
|
|
|
|
virtual void handle(const Messages::WebContentClient::DidLeaveTooltipArea&) override;
|
2020-07-05 16:59:20 +02:00
|
|
|
virtual void handle(const Messages::WebContentClient::DidHoverLink&) override;
|
|
|
|
virtual void handle(const Messages::WebContentClient::DidUnhoverLink&) override;
|
2020-07-06 20:01:46 +02:00
|
|
|
virtual void handle(const Messages::WebContentClient::DidClickLink&) override;
|
|
|
|
virtual void handle(const Messages::WebContentClient::DidMiddleClickLink&) override;
|
2020-07-06 21:58:16 +02:00
|
|
|
virtual void handle(const Messages::WebContentClient::DidStartLoading&) override;
|
2020-07-07 12:24:29 +02:00
|
|
|
virtual void handle(const Messages::WebContentClient::DidRequestContextMenu&) override;
|
|
|
|
virtual void handle(const Messages::WebContentClient::DidRequestLinkContextMenu&) override;
|
2021-04-11 16:49:25 +02:00
|
|
|
virtual void handle(const Messages::WebContentClient::DidRequestImageContextMenu&) override;
|
2021-02-27 21:47:14 -06:00
|
|
|
virtual void handle(const Messages::WebContentClient::DidGetSource&) override;
|
|
|
|
virtual void handle(const Messages::WebContentClient::DidJSConsoleOutput&) override;
|
2021-03-26 10:41:25 -04:00
|
|
|
virtual void handle(const Messages::WebContentClient::DidChangeFavicon&) override;
|
2020-09-12 11:56:13 +02:00
|
|
|
virtual OwnPtr<Messages::WebContentClient::DidRequestAlertResponse> handle(const Messages::WebContentClient::DidRequestAlert&) override;
|
2021-02-10 08:48:28 +01:00
|
|
|
virtual OwnPtr<Messages::WebContentClient::DidRequestConfirmResponse> handle(const Messages::WebContentClient::DidRequestConfirm&) override;
|
2021-02-20 12:05:18 +01:00
|
|
|
virtual OwnPtr<Messages::WebContentClient::DidRequestPromptResponse> handle(const Messages::WebContentClient::DidRequestPrompt&) override;
|
2021-04-11 10:54:11 -04:00
|
|
|
virtual OwnPtr<Messages::WebContentClient::DidRequestCookieResponse> handle(const Messages::WebContentClient::DidRequestCookie&) override;
|
|
|
|
virtual void handle(const Messages::WebContentClient::DidSetCookie&) override;
|
2020-06-17 17:31:42 +02:00
|
|
|
|
2020-08-17 16:20:47 +02:00
|
|
|
OutOfProcessWebView& m_view;
|
2020-06-17 17:31:42 +02:00
|
|
|
};
|
2020-08-24 15:33:18 +04:30
|
|
|
|
|
|
|
}
|