2023-08-20 16:14:31 -04:00
|
|
|
/*
|
2024-05-30 13:35:10 -04:00
|
|
|
* Copyright (c) 2023-2024, Tim Flynn <trflynn89@serenityos.org>
|
2023-08-20 16:14:31 -04:00
|
|
|
*
|
|
|
|
|
* 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>
|
2024-06-13 01:03:56 +02:00
|
|
|
#include <LibWeb/CSS/PreferredContrast.h>
|
2024-06-13 16:15:59 +02:00
|
|
|
#include <LibWeb/CSS/PreferredMotion.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>
|
2023-08-26 22:43:35 -04:00
|
|
|
#include <LibWebView/Forward.h>
|
2023-08-20 16:14:31 -04:00
|
|
|
|
2024-07-16 23:54:53 -06:00
|
|
|
#import <Cocoa/Cocoa.h>
|
2023-08-20 16:14:31 -04:00
|
|
|
|
2023-08-26 16:21:22 -04:00
|
|
|
@protocol LadybirdWebViewObserver <NSObject>
|
|
|
|
|
|
2024-09-17 15:54:34 -04:00
|
|
|
- (String const&)onCreateNewTab:(Optional<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-09-17 15:49:00 -04:00
|
|
|
- (String const&)onCreateChildTab:(Optional<URL::URL> const&)url
|
|
|
|
|
activateTab:(Web::HTML::ActivateTab)activate_tab
|
|
|
|
|
pageIndex:(u64)page_index;
|
|
|
|
|
|
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-04-14 16:54:30 -04:00
|
|
|
|
|
|
|
|
- (void)onURLChange:(URL::URL const&)url;
|
|
|
|
|
- (void)onBackNavigationEnabled:(BOOL)back_enabled
|
|
|
|
|
forwardNavigationEnabled:(BOOL)forward_enabled;
|
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
|
|
|
|
2024-06-10 20:35:45 -04:00
|
|
|
- (void)onFindInPageResult:(size_t)current_match_index
|
|
|
|
|
totalMatchCount:(Optional<size_t> const&)total_match_count;
|
|
|
|
|
|
2023-08-26 16:21:22 -04:00
|
|
|
@end
|
|
|
|
|
|
2024-11-07 12:26:42 -05:00
|
|
|
@interface LadybirdWebView : NSView <NSMenuDelegate>
|
2023-08-20 16:14:31 -04:00
|
|
|
|
2023-08-26 16:21:22 -04:00
|
|
|
- (instancetype)init:(id<LadybirdWebViewObserver>)observer;
|
2024-09-17 15:49:00 -04:00
|
|
|
- (instancetype)initAsChild:(id<LadybirdWebViewObserver>)observer
|
|
|
|
|
parent:(LadybirdWebView*)parent
|
|
|
|
|
pageIndex:(u64)page_index;
|
2023-08-26 16:21:22 -04:00
|
|
|
|
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
|
|
|
|
2024-04-14 16:54:30 -04:00
|
|
|
- (void)navigateBack;
|
|
|
|
|
- (void)navigateForward;
|
|
|
|
|
- (void)reload;
|
|
|
|
|
|
2023-08-26 22:43:35 -04:00
|
|
|
- (WebView::ViewImplementation&)view;
|
2023-08-26 16:21:22 -04:00
|
|
|
- (String const&)handle;
|
|
|
|
|
|
2024-10-28 07:48:49 -04:00
|
|
|
- (void)setWindowPosition:(Gfx::IntPoint)position;
|
|
|
|
|
- (void)setWindowSize:(Gfx::IntSize)size;
|
|
|
|
|
|
2023-08-20 16:14:31 -04:00
|
|
|
- (void)handleResize;
|
2023-09-20 22:10:42 +02:00
|
|
|
- (void)handleDevicePixelRatioChange;
|
2025-07-25 13:23:50 +01:00
|
|
|
- (void)handleDisplayRefreshRateChange;
|
2023-08-20 16:14:31 -04:00
|
|
|
- (void)handleVisibility:(BOOL)is_visible;
|
|
|
|
|
|
2023-08-26 23:44:52 -04:00
|
|
|
- (void)setPreferredColorScheme:(Web::CSS::PreferredColorScheme)color_scheme;
|
2024-06-13 01:03:56 +02:00
|
|
|
- (void)setPreferredContrast:(Web::CSS::PreferredContrast)contrast;
|
2024-06-13 16:15:59 +02:00
|
|
|
- (void)setPreferredMotion:(Web::CSS::PreferredMotion)motion;
|
2023-08-26 23:44:52 -04:00
|
|
|
|
2024-05-31 16:33:52 -04:00
|
|
|
- (void)findInPage:(NSString*)query
|
|
|
|
|
caseSensitivity:(CaseSensitivity)case_sensitivity;
|
2024-05-30 13:35:10 -04:00
|
|
|
- (void)findInPageNextMatch;
|
|
|
|
|
- (void)findInPagePreviousMatch;
|
|
|
|
|
|
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
|