2023-08-20 16:14:31 -04:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <AK/Forward.h>
|
2023-08-26 16:21:22 -04:00
|
|
|
#include <LibGfx/Forward.h>
|
2024-03-18 16:22:27 +13:00
|
|
|
#include <LibURL/Forward.h>
|
2023-08-26 23:44:52 -04:00
|
|
|
#include <LibWeb/CSS/PreferredColorScheme.h>
|
2023-08-26 16:21:22 -04:00
|
|
|
#include <LibWeb/HTML/ActivateTab.h>
|
2024-03-28 12:59:15 -04:00
|
|
|
#include <LibWeb/HTML/AudioPlayState.h>
|
2024-03-28 22:23:33 -04:00
|
|
|
#include <LibWeb/HTML/HistoryHandlingBehavior.h>
|
2023-08-26 22:43:35 -04:00
|
|
|
#include <LibWebView/Forward.h>
|
2023-08-20 16:14:31 -04:00
|
|
|
|
|
|
|
|
#import <System/Cocoa.h>
|
|
|
|
|
|
2023-08-26 16:21:22 -04:00
|
|
|
@protocol LadybirdWebViewObserver <NSObject>
|
|
|
|
|
|
2024-03-18 16:22:27 +13:00
|
|
|
- (String const&)onCreateNewTab:(URL::URL const&)url
|
2023-08-26 16:21:22 -04:00
|
|
|
activateTab:(Web::HTML::ActivateTab)activate_tab;
|
|
|
|
|
|
|
|
|
|
- (String const&)onCreateNewTab:(StringView)html
|
2024-03-18 16:22:27 +13:00
|
|
|
url:(URL::URL const&)url
|
2023-08-26 16:21:22 -04:00
|
|
|
activateTab:(Web::HTML::ActivateTab)activate_tab;
|
|
|
|
|
|
2024-03-18 16:22:27 +13:00
|
|
|
- (void)loadURL:(URL::URL const&)url;
|
|
|
|
|
- (void)onLoadStart:(URL::URL const&)url isRedirect:(BOOL)is_redirect;
|
|
|
|
|
- (void)onLoadFinish:(URL::URL const&)url;
|
2024-03-28 22:23:33 -04:00
|
|
|
- (void)onURLUpdated:(URL::URL const&)url
|
|
|
|
|
historyBehavior:(Web::HTML::HistoryHandlingBehavior)history_behavior;
|
2023-08-26 16:21:22 -04:00
|
|
|
|
2023-12-16 17:49:34 +03:30
|
|
|
- (void)onTitleChange:(ByteString const&)title;
|
2023-08-26 16:21:22 -04:00
|
|
|
- (void)onFaviconChange:(Gfx::Bitmap const&)bitmap;
|
2024-03-28 12:59:15 -04:00
|
|
|
- (void)onAudioPlayStateChange:(Web::HTML::AudioPlayState)play_state;
|
2023-08-26 16:21:22 -04:00
|
|
|
|
|
|
|
|
- (void)onNavigateBack;
|
|
|
|
|
- (void)onNavigateForward;
|
|
|
|
|
- (void)onReload;
|
|
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
2023-12-07 15:53:49 +01:00
|
|
|
@interface LadybirdWebView : NSClipView <NSMenuDelegate>
|
2023-08-20 16:14:31 -04:00
|
|
|
|
2023-08-26 16:21:22 -04:00
|
|
|
- (instancetype)init:(id<LadybirdWebViewObserver>)observer;
|
|
|
|
|
|
2024-03-18 16:22:27 +13:00
|
|
|
- (void)loadURL:(URL::URL const&)url;
|
2023-09-17 17:12:17 +02:00
|
|
|
- (void)loadHTML:(StringView)html;
|
2023-08-20 16:14:31 -04:00
|
|
|
|
2023-08-26 22:43:35 -04:00
|
|
|
- (WebView::ViewImplementation&)view;
|
2023-08-26 16:21:22 -04:00
|
|
|
- (String const&)handle;
|
|
|
|
|
|
2023-08-20 16:14:31 -04:00
|
|
|
- (void)handleResize;
|
2023-09-20 22:10:42 +02:00
|
|
|
- (void)handleDevicePixelRatioChange;
|
2023-08-20 16:14:31 -04:00
|
|
|
- (void)handleScroll;
|
|
|
|
|
- (void)handleVisibility:(BOOL)is_visible;
|
|
|
|
|
|
2023-08-26 23:44:52 -04:00
|
|
|
- (void)setPreferredColorScheme:(Web::CSS::PreferredColorScheme)color_scheme;
|
|
|
|
|
|
2023-10-07 17:21:00 -04:00
|
|
|
- (void)zoomIn;
|
|
|
|
|
- (void)zoomOut;
|
|
|
|
|
- (void)resetZoom;
|
|
|
|
|
- (float)zoomLevel;
|
|
|
|
|
|
2023-12-16 17:49:34 +03:30
|
|
|
- (void)debugRequest:(ByteString const&)request argument:(ByteString const&)argument;
|
2023-09-10 19:49:53 +04:00
|
|
|
|
2023-08-28 16:16:12 -04:00
|
|
|
- (void)viewSource;
|
|
|
|
|
|
2023-08-20 16:14:31 -04:00
|
|
|
@end
|