Tabs implementation

Favicons and stuff too
This commit is contained in:
James Magahern
2020-07-30 23:54:20 -07:00
parent bba9efbbb6
commit 6baf543da3
14 changed files with 487 additions and 105 deletions

View File

@@ -33,6 +33,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, assign) BOOL darkModeEnabled;
- (void)policyDataSourceDidChange;
- (void)tearDown;
@end

View File

@@ -33,6 +33,33 @@
_WKUserStyleSheet *_darkModeStyleSheet;
}
- (void)tearDown
{
[[_webView _remoteObjectRegistry] unregisterExportedObject:self interface:[self _webProcessDelegateInterface]];
}
- (_WKRemoteObjectInterface *)_webProcessDelegateInterface
{
static dispatch_once_t onceToken;
static _WKRemoteObjectInterface *interface = nil;
dispatch_once(&onceToken, ^{
interface = [_WKRemoteObjectInterface remoteObjectInterfaceWithProtocol:@protocol(SBRWebProcessDelegate)];
});
return interface;
}
- (_WKRemoteObjectInterface *)_webProcessProxyInterface
{
static dispatch_once_t onceToken;
static _WKRemoteObjectInterface *interface = nil;
dispatch_once(&onceToken, ^{
interface = [_WKRemoteObjectInterface remoteObjectInterfaceWithProtocol:@protocol(SBRWebProcessProxy)];
});
return interface;
}
- (WKWebView *)webView
{
if (!_webView) {
@@ -56,12 +83,10 @@
WKWebView *webView = [[WKWebView alloc] initWithFrame:CGRectZero configuration:configuration];
// Configure proxy interface (interface to remote web process)
_WKRemoteObjectInterface *proxyInterface = [_WKRemoteObjectInterface remoteObjectInterfaceWithProtocol:@protocol(SBRWebProcessProxy)];
_webProcessProxy = [[webView _remoteObjectRegistry] remoteObjectProxyWithInterface:proxyInterface];
_webProcessProxy = [[webView _remoteObjectRegistry] remoteObjectProxyWithInterface:[self _webProcessProxyInterface]];
// Configure delegate interface (registering us as the web process delegate for the remote process)
_WKRemoteObjectInterface *delegateInterface = [_WKRemoteObjectInterface remoteObjectInterfaceWithProtocol:@protocol(SBRWebProcessDelegate)];
[[webView _remoteObjectRegistry] registerExportedObject:self interface:delegateInterface];
[[webView _remoteObjectRegistry] registerExportedObject:self interface:[self _webProcessDelegateInterface]];
_webView = webView;
_webViewConfiguration = configuration;