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 COMPUTER, 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 COMPUTER, 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 IWebPluginHalterDelegate;
46interface IWebURLRequest;
47interface IWebView;
48
49typedef enum {
50    WebInjectAtDocumentStart = 0,
51    WebInjectAtDocumentEnd,
52} WebUserScriptInjectionTime;
53
54[
55    object,
56    oleautomation,
57    uuid(44914369-DEB5-4fcf-A6A3-30C02E73154F),
58    pointer_default(unique)
59]
60interface IWebViewPrivate : IUnknown
61{
62    /*!
63        @method _setInViewSourceMode:
64        @abstract Used to place a WebView into a special source-viewing mode.
65        - (void)_setInViewSourceMode:(BOOL)flag;
66      */
67    HRESULT setInViewSourceMode([in] BOOL flag);
68
69    /*!
70        @method _inViewSourceMode;
71        @abstract Whether or not the WebView is in source-view mode for HTML.
72        - (BOOL)_inViewSourceMode;
73      */
74    HRESULT inViewSourceMode([out, retval] BOOL* flag);
75
76    HRESULT viewWindow([out, retval] OLE_HANDLE* window);
77
78    // May well become public
79    //- (void)_setFormDelegate:(id<WebFormDelegate>)delegate;
80    HRESULT setFormDelegate([in] IWebFormDelegate* formDelegate);
81
82    //- (id<WebFormDelegate>)_formDelegate;
83    HRESULT formDelegate([out, retval] IWebFormDelegate** formDelegate);
84
85    HRESULT setFrameLoadDelegatePrivate([in] IWebFrameLoadDelegatePrivate* frameLoadDelegatePrivate);
86    HRESULT frameLoadDelegatePrivate([out, retval] IWebFrameLoadDelegatePrivate** frameLoadDelegatePrivate);
87
88    HRESULT scrollOffset([out, retval] LPPOINT offset);
89    HRESULT scrollBy([in] LPPOINT offset);
90    HRESULT visibleContentRect([out, retval] LPRECT rect);
91
92    // SPI for DumpRenderTree
93    HRESULT updateFocusedAndActiveState();
94
95    // Support for displaying multiple text matches.
96    HRESULT markAllMatchesForText([in] BSTR search, [in] BOOL caseSensitive, [in] BOOL highlight, [in] UINT limit, [out] UINT* matches);
97    HRESULT unmarkAllTextMatches();
98    HRESULT rectsForTextMatches([out]IEnumTextMatches** pmatches);
99    HRESULT selectionRect([in, out] RECT* rc);
100    HRESULT generateSelectionImage(BOOL forceWhiteText, [out, retval] OLE_HANDLE* hBitmap);
101
102    HRESULT canHandleRequest([in] IWebURLRequest* request, [out, retval] BOOL* result);
103
104    HRESULT clearFocusNode();
105
106    HRESULT setTabKeyCyclesThroughElements([in] BOOL cycles);
107    HRESULT tabKeyCyclesThroughElements([out, retval] BOOL* result);
108
109    HRESULT setAllowSiteSpecificHacks([in] BOOL allows);
110    HRESULT addAdditionalPluginDirectory([in] BSTR directory);
111
112    HRESULT loadBackForwardListFromOtherView([in] IWebView* otherView);
113
114    HRESULT setCustomDropTarget([in] IDropTarget* dt);
115    HRESULT removeCustomDropTarget();
116
117    HRESULT setInitialFocus([in] BOOL forward);
118
119    HRESULT inspector([out, retval] IWebInspector**);
120
121    HRESULT clearUndoRedoOperations();
122
123    HRESULT setProhibitsMainFrameScrolling([in] BOOL prohibits);
124
125    // SPI for DumpRenderTree. This is global to all WebViews.
126    HRESULT setShouldApplyMacFontAscentHack([in] BOOL shouldApply);
127
128    /*!
129        @method shouldClose:
130        @abstract This function will fire the before unload handler for a page.
131        If the user cancels the closing of a webview from the alert popped up by the
132        before unload handler, then this function will return false.
133    */
134    HRESULT shouldClose([out, retval] BOOL* result);
135
136    // SPI for DumpRenderTree
137    HRESULT executeCoreCommandByName([in] BSTR name, [in] BSTR value);
138
139    HRESULT windowAncestryDidChange();
140
141    HRESULT paintDocumentRectToContext([in] RECT rect, [in] OLE_HANDLE dc);
142
143    HRESULT setDefersCallbacks([in] BOOL defersCallbacks);
144    HRESULT defersCallbacks([out, retval] BOOL* defersCallbacks);
145
146    HRESULT standardUserAgentWithApplicationName([in] BSTR applicationName, [retval][out] BSTR* groupName);
147
148    HRESULT setCustomHTMLTokenizerTimeDelay([in] double timeDelay);
149    HRESULT setCustomHTMLTokenizerChunkSize([in] int chunkSize);
150
151    HRESULT backingStore([out, retval] OLE_HANDLE* hBitmap);
152
153    HRESULT setTransparent([in] BOOL transparent);
154    HRESULT transparent([out, retval] BOOL* transparent);
155
156    HRESULT setAlwaysUsesComplexTextCodePath([in] BOOL complex);
157    HRESULT alwaysUsesComplexTextCodePath([out, retval] BOOL* complex);
158
159    HRESULT setCookieEnabled([in] BOOL enable);
160    HRESULT cookieEnabled([out, retval] BOOL* enabled);
161
162    HRESULT setMediaVolume([in] float volume);
163    HRESULT mediaVolume([out, retval] float* volume);
164
165    // SPI for DumpRenderTree
166    HRESULT clearMainFrameName();
167
168    HRESULT globalHistoryItem([out, retval] IWebHistoryItem**);
169
170    HRESULT registerEmbeddedViewMIMEType([in] BSTR mimeType);
171
172    HRESULT setMemoryCacheDelegateCallsEnabled([in] BOOL enabled);
173
174    HRESULT setJavaScriptURLsAreAllowed([in] BOOL areAllowed);
175
176    HRESULT setCanStartPlugins([in] BOOL canStartPlugins);
177
178    /*!
179        @method MIMETypeForExtension:
180        @abstract Returns the mime type for a certian file extension.
181        @param path The extension of the file to check.
182        @result The mime type of the specified extension.
183        + (BSTR)MIMETypeForPath:(NSString *)path;
184    */
185    HRESULT MIMETypeForExtension([in] BSTR extension, [out, retval] BSTR* mimeType);
186
187    HRESULT addUserScriptToGroup([in] BSTR groupName, [in] IWebScriptWorld*, [in] BSTR source, [in] BSTR url,
188                                 [in] unsigned whitelistCount, [in, size_is(whitelistCount)] BSTR* whitelist,
189                                 [in] unsigned blacklistCount, [in, size_is(blacklistCount)] BSTR* blacklist,
190                                 [in] WebUserScriptInjectionTime injectionTime);
191    HRESULT addUserStyleSheetToGroup([in] BSTR groupName, [in] IWebScriptWorld*, [in] BSTR source, [in] BSTR url,
192                                     [in] unsigned whitelistCount, [in, size_is(whitelistCount)] BSTR* whitelist,
193                                     [in] unsigned blacklistCount, [in, size_is(blacklistCount)] BSTR* blacklist);
194    HRESULT removeUserScriptFromGroup([in] BSTR groupName, [in] IWebScriptWorld*, [in] BSTR url);
195    HRESULT removeUserStyleSheetFromGroup([in] BSTR groupName, [in] IWebScriptWorld*, [in] BSTR url);
196    HRESULT removeUserScriptsFromGroup([in] BSTR groupName, [in] IWebScriptWorld*);
197    HRESULT removeUserStyleSheetsFromGroup([in] BSTR groupName, [in] IWebScriptWorld*);
198    HRESULT removeAllUserContentFromGroup([in] BSTR groupName);
199
200    HRESULT setPluginHalterDelegate([in] IWebPluginHalterDelegate* d);
201    HRESULT pluginHalterDelegate([retval, out] IWebPluginHalterDelegate** d);
202
203    // If rect is 0, the entire backing store will be invalidated.
204    HRESULT invalidateBackingStore([in] const RECT* rect);
205
206    // Whitelists access from an origin (sourceOrigin) to a set of one or more origins described by the parameters:
207    // - destinationProtocol: The protocol to grant access to.
208    // - destinationHost: The host to grant access to.
209    // - allowDestinationSubdomains: If host is a domain, setting this to YES will whitelist host and all its subdomains, recursively.
210    HRESULT whiteListAccessFromOrigin([in] BSTR sourceOrigin, [in] BSTR destinationProtocol, [in] BSTR destinationHost, [in] BOOL allowDestinationSubdomains);
211
212    // Removes all white list entries created with whiteListAccessFromOrigin.
213    HRESULT resetOriginAccessWhiteLists();
214
215    HRESULT setHistoryDelegate([in] IWebHistoryDelegate* historyDelegate);
216    HRESULT historyDelegate([out,retval] IWebHistoryDelegate** historyDelegate);
217    HRESULT addVisitedLinks([in] BSTR* visitedURLs, [in] unsigned visitedURLCount);
218
219    HRESULT isNodeHaltedPlugin([in] IDOMNode*, [retval, out] BOOL*);
220    HRESULT restartHaltedPluginForNode([in] IDOMNode*);
221    HRESULT hasPluginForNodeBeenHalted([in] IDOMNode*, [retval, out] BOOL*);
222
223    HRESULT setGeolocationProvider([in] IWebGeolocationProvider* locationProvider);
224    HRESULT geolocationProvider([out, retval] IWebGeolocationProvider** locationProvider);
225    HRESULT geolocationDidChangePosition([in] IWebGeolocationPosition* position);
226    HRESULT geolocationDidFailWithError([in] IWebError* error);
227
228    HRESULT setDomainRelaxationForbiddenForURLScheme([in] BOOL forbidden, [in] BSTR scheme);
229}
230