1/*
2 * Copyright (C) 2006, 2007, 2008 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. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#ifndef DO_NO_IMPORTS
27import "oaidl.idl";
28import "ocidl.idl";
29import "IWebFormDelegate.idl";
30import "IWebFrameLoadDelegatePrivate.idl";
31import "IWebHistoryDelegate.idl";
32import "IWebInspector.idl";
33import "IWebInspectorPrivate.idl";
34#endif
35
36// Sent when IWebView::close is called. No userInfo is associated with this notification.
37cpp_quote("#define WebViewWillCloseNotification L\"WebViewWillCloseNotification\"")
38
39interface IEnumTextMatches;
40interface IWebFormDelegate;
41interface IWebFrameLoadDelegatePrivate;
42interface IWebHistoryDelegate;
43interface IWebInspector;
44interface IWebInspectorPrivate;
45interface IWebURLRequest;
46interface IWebView;
47
48typedef enum {
49    WebInjectAtDocumentStart = 0,
50    WebInjectAtDocumentEnd,
51} WebUserScriptInjectionTime;
52
53[
54    object,
55    oleautomation,
56    uuid(44914369-DEB5-4fcf-A6A3-30C02E73154F),
57    pointer_default(unique)
58]
59interface IWebViewPrivate : IUnknown
60{
61    /*!
62        @method _setInViewSourceMode:
63        @abstract Used to place a WebView into a special source-viewing mode.
64        - (void)_setInViewSourceMode:(BOOL)flag;
65      */
66    HRESULT setInViewSourceMode([in] BOOL flag);
67
68    /*!
69        @method _inViewSourceMode;
70        @abstract Whether or not the WebView is in source-view mode for HTML.
71        - (BOOL)_inViewSourceMode;
72      */
73    HRESULT inViewSourceMode([out, retval] BOOL* flag);
74
75    HRESULT viewWindow([out, retval] HWND* window);
76
77    // May well become public
78    //- (void)_setFormDelegate:(id<WebFormDelegate>)delegate;
79    HRESULT setFormDelegate([in] IWebFormDelegate* formDelegate);
80
81    //- (id<WebFormDelegate>)_formDelegate;
82    HRESULT formDelegate([out, retval] IWebFormDelegate** formDelegate);
83
84    HRESULT setFrameLoadDelegatePrivate([in] IWebFrameLoadDelegatePrivate* frameLoadDelegatePrivate);
85    HRESULT frameLoadDelegatePrivate([out, retval] IWebFrameLoadDelegatePrivate** frameLoadDelegatePrivate);
86
87    HRESULT scrollOffset([out, retval] LPPOINT offset);
88    HRESULT scrollBy([in] LPPOINT offset);
89    HRESULT visibleContentRect([out, retval] LPRECT rect);
90
91    // SPI for DumpRenderTree
92    HRESULT updateFocusedAndActiveState();
93
94    // Support for displaying multiple text matches.
95    HRESULT markAllMatchesForText([in] BSTR search, [in] BOOL caseSensitive, [in] BOOL highlight, [in] UINT limit, [out] UINT* matches);
96    HRESULT unmarkAllTextMatches();
97    HRESULT rectsForTextMatches([out]IEnumTextMatches** pmatches);
98    HRESULT selectionRect([in, out] RECT* rc);
99    HRESULT generateSelectionImage(BOOL forceWhiteText, [out, retval] HBITMAP* hBitmap);
100
101    HRESULT canHandleRequest([in] IWebURLRequest* request, [out, retval] BOOL* result);
102
103    HRESULT clearFocusNode();
104
105    HRESULT setTabKeyCyclesThroughElements([in] BOOL cycles);
106    HRESULT tabKeyCyclesThroughElements([out, retval] BOOL* result);
107
108    HRESULT setAllowSiteSpecificHacks([in] BOOL allows);
109    HRESULT addAdditionalPluginDirectory([in] BSTR directory);
110
111    HRESULT loadBackForwardListFromOtherView([in] IWebView* otherView);
112
113    HRESULT setCustomDropTarget([in] IDropTarget* dt);
114    HRESULT removeCustomDropTarget();
115
116    HRESULT setInitialFocus([in] BOOL forward);
117
118    HRESULT inspector([out, retval] IWebInspector**);
119
120    HRESULT clearUndoRedoOperations();
121
122    HRESULT setProhibitsMainFrameScrolling([in] BOOL prohibits);
123
124    // SPI for DumpRenderTree. This is global to all WebViews.
125    HRESULT setShouldApplyMacFontAscentHack([in] BOOL shouldApply);
126
127    /*!
128        @method shouldClose:
129        @abstract This function will fire the before unload handler for a page.
130        If the user cancels the closing of a webview from the alert popped up by the
131        before unload handler, then this function will return false.
132    */
133    HRESULT shouldClose([out, retval] BOOL* result);
134
135    // SPI for DumpRenderTree
136    HRESULT executeCoreCommandByName([in] BSTR name, [in] BSTR value);
137
138    HRESULT windowAncestryDidChange();
139
140    HRESULT paintDocumentRectToContext([in] RECT rect, [in] HDC dc);
141
142    HRESULT setDefersCallbacks([in] BOOL defersCallbacks);
143    HRESULT defersCallbacks([out, retval] BOOL* defersCallbacks);
144
145    HRESULT standardUserAgentWithApplicationName([in] BSTR applicationName, [retval][out] BSTR* groupName);
146
147    HRESULT setCustomHTMLTokenizerTimeDelay([in] double timeDelay);
148    HRESULT setCustomHTMLTokenizerChunkSize([in] int chunkSize);
149
150    HRESULT backingStore([out, retval] HBITMAP* hBitmap);
151
152    HRESULT setTransparent([in] BOOL transparent);
153    HRESULT transparent([out, retval] BOOL* transparent);
154
155    HRESULT setAlwaysUsesComplexTextCodePath([in] BOOL complex);
156    HRESULT alwaysUsesComplexTextCodePath([out, retval] BOOL* complex);
157
158    HRESULT setCookieEnabled([in] BOOL enable);
159    HRESULT cookieEnabled([out, retval] BOOL* enabled);
160
161    HRESULT setMediaVolume([in] float volume);
162    HRESULT mediaVolume([out, retval] float* volume);
163
164    // SPI for DumpRenderTree
165    HRESULT clearMainFrameName();
166
167    HRESULT globalHistoryItem([out, retval] IWebHistoryItem**);
168
169    HRESULT registerEmbeddedViewMIMEType([in] BSTR mimeType);
170
171    HRESULT setMemoryCacheDelegateCallsEnabled([in] BOOL enabled);
172
173    HRESULT setJavaScriptURLsAreAllowed([in] BOOL areAllowed);
174
175    HRESULT setCanStartPlugins([in] BOOL canStartPlugins);
176
177    /*!
178        @method MIMETypeForExtension:
179        @abstract Returns the mime type for a certian file extension.
180        @param path The extension of the file to check.
181        @result The mime type of the specified extension.
182        + (BSTR)MIMETypeForPath:(NSString *)path;
183    */
184    HRESULT MIMETypeForExtension([in] BSTR extension, [out, retval] BSTR* mimeType);
185
186    HRESULT addUserScriptToGroup([in] BSTR groupName, [in] IWebScriptWorld*, [in] BSTR source, [in] BSTR url,
187                                 [in] unsigned whitelistCount, [in, size_is(whitelistCount)] BSTR* whitelist,
188                                 [in] unsigned blacklistCount, [in, size_is(blacklistCount)] BSTR* blacklist,
189                                 [in] WebUserScriptInjectionTime injectionTime);
190    HRESULT addUserStyleSheetToGroup([in] BSTR groupName, [in] IWebScriptWorld*, [in] BSTR source, [in] BSTR url,
191                                     [in] unsigned whitelistCount, [in, size_is(whitelistCount)] BSTR* whitelist,
192                                     [in] unsigned blacklistCount, [in, size_is(blacklistCount)] BSTR* blacklist);
193    HRESULT removeUserScriptFromGroup([in] BSTR groupName, [in] IWebScriptWorld*, [in] BSTR url);
194    HRESULT removeUserStyleSheetFromGroup([in] BSTR groupName, [in] IWebScriptWorld*, [in] BSTR url);
195    HRESULT removeUserScriptsFromGroup([in] BSTR groupName, [in] IWebScriptWorld*);
196    HRESULT removeUserStyleSheetsFromGroup([in] BSTR groupName, [in] IWebScriptWorld*);
197    HRESULT removeAllUserContentFromGroup([in] BSTR groupName);
198
199    HRESULT unused1();
200    HRESULT unused2();
201
202    // If rect is 0, the entire backing store will be invalidated.
203    HRESULT invalidateBackingStore([in] const RECT* rect);
204
205    // Whitelists access from an origin (sourceOrigin) to a set of one or more origins described by the parameters:
206    // - destinationProtocol: The protocol to grant access to.
207    // - destinationHost: The host to grant access to.
208    // - allowDestinationSubdomains: If host is a domain, setting this to YES will whitelist host and all its subdomains, recursively.
209    HRESULT addOriginAccessWhitelistEntry([in] BSTR sourceOrigin, [in] BSTR destinationProtocol, [in] BSTR destinationHost, [in] BOOL allowDestinationSubdomains);
210
211    // Removes a white list entry created with addOriginAccessWhitelistEntry. See above.
212    HRESULT removeOriginAccessWhitelistEntry([in] BSTR sourceOrigin, [in] BSTR destinationProtocol, [in] BSTR destinationHost, [in] BOOL allowDestinationSubdomains);
213
214    // Removes all white list entries created with addOriginAccessWhitelistEntry.
215    HRESULT resetOriginAccessWhitelists();
216
217    HRESULT setHistoryDelegate([in] IWebHistoryDelegate* historyDelegate);
218    HRESULT historyDelegate([out,retval] IWebHistoryDelegate** historyDelegate);
219    HRESULT addVisitedLinks([in] BSTR* visitedURLs, [in] unsigned visitedURLCount);
220
221    HRESULT unused3();
222    HRESULT unused4();
223    HRESULT unused5();
224
225    HRESULT setGeolocationProvider([in] IWebGeolocationProvider* locationProvider);
226    HRESULT geolocationProvider([out, retval] IWebGeolocationProvider** locationProvider);
227    HRESULT geolocationDidChangePosition([in] IWebGeolocationPosition* position);
228    HRESULT geolocationDidFailWithError([in] IWebError* error);
229
230    HRESULT setDomainRelaxationForbiddenForURLScheme([in] BOOL forbidden, [in] BSTR scheme);
231
232    HRESULT registerURLSchemeAsSecure([in] BSTR scheme);
233
234    HRESULT nextDisplayIsSynchronous();
235
236    HRESULT paintScrollViewRectToContextAtPoint([in] RECT rect, [in] POINT pt, [in] HDC dc);
237
238    [local] HRESULT reportException([in] JSContextRef context, [in] JSValueRef exception);
239
240    [local] HRESULT elementFromJS([in] JSContextRef context, [in] JSValueRef nodeObject, [out, retval] IDOMElement** element);
241
242
243    /*!
244        @method defaultMinimumTimerInterval
245        @discussion Returns the default minimum interval for DOMTimers on all pages, not
246        just the one associated with this receiver.
247        - (double)interval;
248    */
249    HRESULT defaultMinimumTimerInterval([out, retval] double* interval);
250
251    /*!
252        @method setMinimumTimerInterval
253        @discussion Sets the minimum interval for DOMTimers on the web page associated
254        with the receiver.
255        - (double)interval;
256    */
257    HRESULT setMinimumTimerInterval([in] double interval);
258
259    /*!
260        @method _HTTPPipeliningEnabled
261        @abstract Checks the HTTP pipelining status.
262        @discussion Defaults to NO.
263        @result YES if HTTP pipelining is enabled, NO if not enabled.
264     */
265    HRESULT httpPipeliningEnabled([out, retval] BOOL* enabled);
266
267    /*!
268        @method _setHTTPPipeliningEnabled:
269        @abstract Set the HTTP pipelining status.
270        @discussion Defaults to NO.
271        @param enabled The new HTTP pipelining status.
272     */
273    HRESULT setHTTPPipeliningEnabled([in] BOOL enabled);
274
275    HRESULT setUsesLayeredWindow([in] BOOL usesLayeredWindow);
276    HRESULT usesLayeredWindow([out, retval] BOOL* usesLayeredWindow);
277
278    HRESULT registerURLSchemeAsAllowingLocalStorageAccessInPrivateBrowsing([in] BSTR scheme);
279    HRESULT registerURLSchemeAsAllowingDatabaseAccessInPrivateBrowsing([in] BSTR scheme);
280    // Used by TextInputController in DumpRenderTree
281
282    HRESULT setCompositionForTesting([in] BSTR composition,[in] UINT from,[in] UINT length);
283
284    HRESULT hasCompositionForTesting([out, retval] BOOL* result);
285
286    HRESULT confirmCompositionForTesting([in] BSTR composition);
287
288    HRESULT compositionRangeForTesting([out] UINT* startPosition, [out] UINT* length);
289
290    HRESULT firstRectForCharacterRangeForTesting([in] UINT location, [in] UINT length, [out, retval] RECT* resultRect);
291
292    HRESULT selectedRangeForTesting([out] UINT* location, [out] UINT* length);
293}
294