638c6ef68e827caf9647f5d414ffea62bbcef9bf
[WebKit-https.git] / Source / WebKit2 / UIProcess / API / Cocoa / WKWebViewPrivate.h
1 /*
2  * Copyright (C) 2014 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23  * THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 #import <WebKit2/WKWebView.h>
27
28 #if WK_API_ENABLED
29
30 typedef NS_OPTIONS(NSUInteger, _WKRenderingProgressEvents) {
31     _WKRenderingProgressEventFirstLayout = 1 << 0,
32     _WKRenderingProgressEventFirstPaintWithSignificantArea = 1 << 2,
33 };
34
35 typedef NS_ENUM(NSInteger, _WKPaginationMode) {
36     _WKPaginationModeUnpaginated,
37     _WKPaginationModeLeftToRight,
38     _WKPaginationModeRightToLeft,
39     _WKPaginationModeTopToBottom,
40     _WKPaginationModeBottomToTop,
41 };
42
43 typedef NS_OPTIONS(NSUInteger, _WKFindOptions) {
44     _WKFindOptionsCaseInsensitive = 1 << 0,
45     _WKFindOptionsAtWordStarts = 1 << 1,
46     _WKFindOptionsTreatMedialCapitalAsWordStart = 1 << 2,
47     _WKFindOptionsBackwards = 1 << 3,
48     _WKFindOptionsWrapAround = 1 << 4,
49     _WKFindOptionsShowOverlay = 1 << 5,
50     _WKFindOptionsShowFindIndicator = 1 << 6,
51     _WKFindOptionsShowHighlight = 1 << 7,
52     _WKFindOptionsDetermineMatchIndex = 1 << 8,
53 };
54
55 @class WKBrowsingContextHandle;
56 @class _WKRemoteObjectRegistry;
57
58 @protocol WKHistoryDelegatePrivate;
59 @protocol _WKFindDelegate;
60 @protocol _WKFormDelegate;
61
62 @interface WKWebView (WKPrivate)
63
64 // FIXME: This should return a _WKRemoteObjectRegistry *.
65 @property (nonatomic, readonly) id _remoteObjectRegistry;
66 @property (nonatomic, readonly) WKBrowsingContextHandle *_handle;
67
68 @property (nonatomic, setter=_setObservedRenderingProgressEvents:) _WKRenderingProgressEvents _observedRenderingProgressEvents;
69
70 @property (nonatomic, weak, setter=_setHistoryDelegate:) id <WKHistoryDelegatePrivate> _historyDelegate;
71
72 @property (nonatomic, readonly) NSURL *_unreachableURL;
73
74 - (void)_loadAlternateHTMLString:(NSString *)string baseURL:(NSURL *)baseURL forUnreachableURL:(NSURL *)unreachableURL;
75
76 - (WKNavigation *)_reload;
77
78 @property (nonatomic, readonly) NSArray *_certificateChain;
79 @property (nonatomic, readonly) NSURL *_committedURL;
80
81 @property (copy, setter=_setApplicationNameForUserAgent:) NSString *_applicationNameForUserAgent;
82 @property (copy, setter=_setCustomUserAgent:) NSString *_customUserAgent;
83
84 @property (nonatomic, readonly) pid_t _webProcessIdentifier;
85
86 @property (nonatomic, readonly) NSData *_sessionState;
87 - (void)_restoreFromSessionState:(NSData *)sessionState;
88
89 @property (nonatomic, setter=_setPrivateBrowsingEnabled:) BOOL _privateBrowsingEnabled;
90
91 @property (nonatomic, setter=_setAllowsRemoteInspection:) BOOL _allowsRemoteInspection;
92
93 - (void)_close;
94
95 #if TARGET_OS_IPHONE
96 @property (nonatomic, setter=_setMinimumLayoutSizeOverride:) CGSize _minimumLayoutSizeOverride;
97 @property (nonatomic, setter=_setMinimumLayoutSizeOverrideForMinimalUI:) CGSize _minimumLayoutSizeOverrideForMinimalUI;
98
99 // Define the inset of the scrollview unusable by the web page.
100 @property (nonatomic, setter=_setObscuredInsets:) UIEdgeInsets _obscuredInsets;
101
102 @property (nonatomic, setter=_setBackgroundExtendsBeyondPage:) BOOL _backgroundExtendsBeyondPage;
103
104 // FIXME: Remove these three properties once we expose WKWebViewContentProvider as API.
105 @property (nonatomic, readonly, getter=_isDisplayingPDF) BOOL _displayingPDF;
106 @property (nonatomic, readonly) NSData *_dataForDisplayedPDF;
107 // FIXME: This can be removed once WKNavigation's response property is implemented.
108 @property (nonatomic, readonly) NSString *_suggestedFilenameForDisplayedPDF;
109
110 - (void)_beginInteractiveObscuredInsetsChange;
111 - (void)_endInteractiveObscuredInsetsChange;
112
113 - (void)_beginAnimatedResizeWithUpdates:(void (^)(void))updateBlock;
114 - (void)_endAnimatedResize;
115
116 - (void)_showInspectorIndication;
117 - (void)_hideInspectorIndication;
118
119 - (void)_snapshotRect:(CGRect)rectInViewCoordinates intoImageOfWidth:(CGFloat)imageWidth completionHandler:(void(^)(CGImageRef))completionHandler;
120
121 - (UIView *)_viewForFindUI;
122
123 // FIXME: Remove this once nobody uses it.
124 @property (nonatomic, readonly) NSURL *activeURL;
125
126 #else
127 @property (readonly) NSColor *_pageExtendedBackgroundColor;
128 @property (nonatomic, setter=_setDrawsTransparentBackground:) BOOL _drawsTransparentBackground;
129 @property (nonatomic, setter=_setTopContentInset:) CGFloat _topContentInset;
130 #endif
131
132 - (void)_runJavaScriptInMainFrame:(NSString *)scriptString;
133
134 @property (nonatomic, setter=_setPaginationMode:) _WKPaginationMode _paginationMode;
135 // Whether the column-break-{before,after} properties are respected instead of the
136 // page-break-{before,after} properties.
137 @property (nonatomic, setter=_setPaginationBehavesLikeColumns:) BOOL _paginationBehavesLikeColumns;
138 // Set to 0 to have the page length equal the view length.
139 @property (nonatomic, setter=_setPageLength:) CGFloat _pageLength;
140 @property (nonatomic, setter=_setGapBetweenPages:) CGFloat _gapBetweenPages;
141 @property (readonly) NSUInteger _pageCount;
142
143 @property (nonatomic, readonly) BOOL _supportsTextZoom;
144 @property (nonatomic, setter=_setTextZoomFactor:) double _textZoomFactor;
145 @property (nonatomic, setter=_setPageZoomFactor:) double _pageZoomFactor;
146
147 @property (nonatomic, weak, setter=_setFindDelegate:) id <_WKFindDelegate> _findDelegate;
148 - (void)_findString:(NSString *)string options:(_WKFindOptions)options maxCount:(NSUInteger)maxCount;
149 - (void)_countStringMatches:(NSString *)string options:(_WKFindOptions)options maxCount:(NSUInteger)maxCount;
150 - (void)_hideFindUI;
151
152 @property (nonatomic, weak, setter=_setFormDelegate:) id <_WKFormDelegate> _formDelegate;
153
154 @end
155
156 #endif