|
1 /* |
|
2 * Copyright (C) 2005, 2006, 2007 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 * |
|
8 * 1. Redistributions of source code must retain the above copyright |
|
9 * notice, this list of conditions and the following disclaimer. |
|
10 * 2. Redistributions in binary form must reproduce the above copyright |
|
11 * notice, this list of conditions and the following disclaimer in the |
|
12 * documentation and/or other materials provided with the distribution. |
|
13 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of |
|
14 * its contributors may be used to endorse or promote products derived |
|
15 * from this software without specific prior written permission. |
|
16 * |
|
17 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY |
|
18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
|
20 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY |
|
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
|
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
|
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
|
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
|
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
27 */ |
|
28 |
|
29 #ifndef UIDelegate_h |
|
30 #define UIDelegate_h |
|
31 |
|
32 #include <WebCore/COMPtr.h> |
|
33 #include <WebKit/WebKit.h> |
|
34 #include <wtf/OwnPtr.h> |
|
35 #include <windef.h> |
|
36 |
|
37 class DRTUndoManager; |
|
38 class DRTDesktopNotificationPresenter; |
|
39 |
|
40 class UIDelegate : public IWebUIDelegate2, IWebUIDelegatePrivate3 { |
|
41 public: |
|
42 UIDelegate(); |
|
43 |
|
44 void resetUndoManager(); |
|
45 |
|
46 // IUnknown |
|
47 virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject); |
|
48 virtual ULONG STDMETHODCALLTYPE AddRef(void); |
|
49 virtual ULONG STDMETHODCALLTYPE Release(void); |
|
50 |
|
51 // IWebUIDelegate |
|
52 virtual HRESULT STDMETHODCALLTYPE createWebViewWithRequest( |
|
53 /* [in] */ IWebView *sender, |
|
54 /* [in] */ IWebURLRequest *request, |
|
55 /* [retval][out] */ IWebView **newWebView); |
|
56 |
|
57 virtual HRESULT STDMETHODCALLTYPE webViewShow( |
|
58 /* [in] */ IWebView *sender) { return E_NOTIMPL; } |
|
59 |
|
60 virtual HRESULT STDMETHODCALLTYPE webViewClose( |
|
61 /* [in] */ IWebView *sender); |
|
62 |
|
63 virtual HRESULT STDMETHODCALLTYPE webViewFocus( |
|
64 /* [in] */ IWebView *sender); |
|
65 |
|
66 virtual HRESULT STDMETHODCALLTYPE webViewUnfocus( |
|
67 /* [in] */ IWebView *sender); |
|
68 |
|
69 virtual HRESULT STDMETHODCALLTYPE webViewFirstResponder( |
|
70 /* [in] */ IWebView *sender, |
|
71 /* [retval][out] */ OLE_HANDLE *responder) { return E_NOTIMPL; } |
|
72 |
|
73 virtual HRESULT STDMETHODCALLTYPE makeFirstResponder( |
|
74 /* [in] */ IWebView *sender, |
|
75 /* [in] */ OLE_HANDLE responder) { return E_NOTIMPL; } |
|
76 |
|
77 virtual HRESULT STDMETHODCALLTYPE setStatusText( |
|
78 /* [in] */ IWebView *sender, |
|
79 /* [in] */ BSTR text); |
|
80 |
|
81 virtual HRESULT STDMETHODCALLTYPE webViewStatusText( |
|
82 /* [in] */ IWebView *sender, |
|
83 /* [retval][out] */ BSTR *text) { return E_NOTIMPL; } |
|
84 |
|
85 virtual HRESULT STDMETHODCALLTYPE webViewAreToolbarsVisible( |
|
86 /* [in] */ IWebView *sender, |
|
87 /* [retval][out] */ BOOL *visible) { return E_NOTIMPL; } |
|
88 |
|
89 virtual HRESULT STDMETHODCALLTYPE setToolbarsVisible( |
|
90 /* [in] */ IWebView *sender, |
|
91 /* [in] */ BOOL visible) { return E_NOTIMPL; } |
|
92 |
|
93 virtual HRESULT STDMETHODCALLTYPE webViewIsStatusBarVisible( |
|
94 /* [in] */ IWebView *sender, |
|
95 /* [retval][out] */ BOOL *visible) { return E_NOTIMPL; } |
|
96 |
|
97 virtual HRESULT STDMETHODCALLTYPE setStatusBarVisible( |
|
98 /* [in] */ IWebView *sender, |
|
99 /* [in] */ BOOL visible) { return E_NOTIMPL; } |
|
100 |
|
101 virtual HRESULT STDMETHODCALLTYPE webViewIsResizable( |
|
102 /* [in] */ IWebView *sender, |
|
103 /* [retval][out] */ BOOL *resizable) { return E_NOTIMPL; } |
|
104 |
|
105 virtual HRESULT STDMETHODCALLTYPE setResizable( |
|
106 /* [in] */ IWebView *sender, |
|
107 /* [in] */ BOOL resizable) { return E_NOTIMPL; } |
|
108 |
|
109 virtual HRESULT STDMETHODCALLTYPE setFrame( |
|
110 /* [in] */ IWebView *sender, |
|
111 /* [in] */ RECT *frame); |
|
112 |
|
113 virtual HRESULT STDMETHODCALLTYPE webViewFrame( |
|
114 /* [in] */ IWebView *sender, |
|
115 /* [retval][out] */ RECT *frame); |
|
116 |
|
117 virtual HRESULT STDMETHODCALLTYPE setContentRect( |
|
118 /* [in] */ IWebView *sender, |
|
119 /* [in] */ RECT *contentRect) { return E_NOTIMPL; } |
|
120 |
|
121 virtual HRESULT STDMETHODCALLTYPE webViewContentRect( |
|
122 /* [in] */ IWebView *sender, |
|
123 /* [retval][out] */ RECT *contentRect) { return E_NOTIMPL; } |
|
124 |
|
125 virtual HRESULT STDMETHODCALLTYPE runJavaScriptAlertPanelWithMessage( |
|
126 /* [in] */ IWebView *sender, |
|
127 /* [in] */ BSTR message); |
|
128 |
|
129 virtual HRESULT STDMETHODCALLTYPE runJavaScriptConfirmPanelWithMessage( |
|
130 /* [in] */ IWebView *sender, |
|
131 /* [in] */ BSTR message, |
|
132 /* [retval][out] */ BOOL *result); |
|
133 |
|
134 virtual HRESULT STDMETHODCALLTYPE runJavaScriptTextInputPanelWithPrompt( |
|
135 /* [in] */ IWebView *sender, |
|
136 /* [in] */ BSTR message, |
|
137 /* [in] */ BSTR defaultText, |
|
138 /* [retval][out] */ BSTR *result); |
|
139 |
|
140 virtual HRESULT STDMETHODCALLTYPE runBeforeUnloadConfirmPanelWithMessage( |
|
141 /* [in] */ IWebView *sender, |
|
142 /* [in] */ BSTR message, |
|
143 /* [in] */ IWebFrame *initiatedByFrame, |
|
144 /* [retval][out] */ BOOL *result); |
|
145 |
|
146 virtual HRESULT STDMETHODCALLTYPE runOpenPanelForFileButtonWithResultListener( |
|
147 /* [in] */ IWebView *sender, |
|
148 /* [in] */ IWebOpenPanelResultListener *resultListener) { return E_NOTIMPL; } |
|
149 |
|
150 virtual HRESULT STDMETHODCALLTYPE mouseDidMoveOverElement( |
|
151 /* [in] */ IWebView *sender, |
|
152 /* [in] */ IPropertyBag *elementInformation, |
|
153 /* [in] */ UINT modifierFlags) { return E_NOTIMPL; } |
|
154 |
|
155 virtual HRESULT STDMETHODCALLTYPE contextMenuItemsForElement( |
|
156 /* [in] */ IWebView *sender, |
|
157 /* [in] */ IPropertyBag *element, |
|
158 /* [in] */ OLE_HANDLE defaultItems, |
|
159 /* [retval][out] */ OLE_HANDLE *resultMenu) { return E_NOTIMPL; } |
|
160 |
|
161 virtual HRESULT STDMETHODCALLTYPE validateUserInterfaceItem( |
|
162 /* [in] */ IWebView *webView, |
|
163 /* [in] */ UINT itemCommandID, |
|
164 /* [in] */ BOOL defaultValidation, |
|
165 /* [retval][out] */ BOOL *isValid) { return E_NOTIMPL; } |
|
166 |
|
167 virtual HRESULT STDMETHODCALLTYPE shouldPerformAction( |
|
168 /* [in] */ IWebView *webView, |
|
169 /* [in] */ UINT itemCommandID, |
|
170 /* [in] */ UINT sender) { return E_NOTIMPL; } |
|
171 |
|
172 virtual HRESULT STDMETHODCALLTYPE dragDestinationActionMaskForDraggingInfo( |
|
173 /* [in] */ IWebView *webView, |
|
174 /* [in] */ IDataObject *draggingInfo, |
|
175 /* [retval][out] */ WebDragDestinationAction *action) { return E_NOTIMPL; } |
|
176 |
|
177 virtual HRESULT STDMETHODCALLTYPE willPerformDragDestinationAction( |
|
178 /* [in] */ IWebView *webView, |
|
179 /* [in] */ WebDragDestinationAction action, |
|
180 /* [in] */ IDataObject *draggingInfo) { return E_NOTIMPL; } |
|
181 |
|
182 virtual HRESULT STDMETHODCALLTYPE dragSourceActionMaskForPoint( |
|
183 /* [in] */ IWebView *webView, |
|
184 /* [in] */ LPPOINT point, |
|
185 /* [retval][out] */ WebDragSourceAction *action) { return E_NOTIMPL; } |
|
186 |
|
187 virtual HRESULT STDMETHODCALLTYPE willPerformDragSourceAction( |
|
188 /* [in] */ IWebView *webView, |
|
189 /* [in] */ WebDragSourceAction action, |
|
190 /* [in] */ LPPOINT point, |
|
191 /* [in] */ IDataObject *pasteboard, |
|
192 /* [retval][out] */ IDataObject **newPasteboard) { return E_NOTIMPL; } |
|
193 |
|
194 virtual HRESULT STDMETHODCALLTYPE contextMenuItemSelected( |
|
195 /* [in] */ IWebView *sender, |
|
196 /* [in] */ void *item, |
|
197 /* [in] */ IPropertyBag *element) { return E_NOTIMPL; } |
|
198 |
|
199 virtual HRESULT STDMETHODCALLTYPE hasCustomMenuImplementation( |
|
200 /* [retval][out] */ BOOL *hasCustomMenus); |
|
201 |
|
202 virtual HRESULT STDMETHODCALLTYPE trackCustomPopupMenu( |
|
203 /* [in] */ IWebView *sender, |
|
204 /* [in] */ OLE_HANDLE menu, |
|
205 /* [in] */ LPPOINT point); |
|
206 |
|
207 virtual HRESULT STDMETHODCALLTYPE measureCustomMenuItem( |
|
208 /* [in] */ IWebView *sender, |
|
209 /* [in] */ void *measureItem) { return E_NOTIMPL; } |
|
210 |
|
211 virtual HRESULT STDMETHODCALLTYPE drawCustomMenuItem( |
|
212 /* [in] */ IWebView *sender, |
|
213 /* [in] */ void *drawItem) { return E_NOTIMPL; } |
|
214 |
|
215 virtual HRESULT STDMETHODCALLTYPE addCustomMenuDrawingData( |
|
216 /* [in] */ IWebView *sender, |
|
217 /* [in] */ OLE_HANDLE menu) { return E_NOTIMPL; } |
|
218 |
|
219 virtual HRESULT STDMETHODCALLTYPE cleanUpCustomMenuDrawingData( |
|
220 /* [in] */ IWebView *sender, |
|
221 /* [in] */ OLE_HANDLE menu) { return E_NOTIMPL; } |
|
222 |
|
223 virtual HRESULT STDMETHODCALLTYPE canTakeFocus( |
|
224 /* [in] */ IWebView *sender, |
|
225 /* [in] */ BOOL forward, |
|
226 /* [out] */ BOOL *result) { return E_NOTIMPL; } |
|
227 |
|
228 virtual HRESULT STDMETHODCALLTYPE takeFocus( |
|
229 /* [in] */ IWebView *sender, |
|
230 /* [in] */ BOOL forward) { return E_NOTIMPL; } |
|
231 |
|
232 virtual HRESULT STDMETHODCALLTYPE registerUndoWithTarget( |
|
233 /* [in] */ IWebUndoTarget *target, |
|
234 /* [in] */ BSTR actionName, |
|
235 /* [in] */ IUnknown *actionArg); |
|
236 |
|
237 virtual HRESULT STDMETHODCALLTYPE removeAllActionsWithTarget( |
|
238 /* [in] */ IWebUndoTarget *target); |
|
239 |
|
240 virtual HRESULT STDMETHODCALLTYPE setActionTitle( |
|
241 /* [in] */ BSTR actionTitle); |
|
242 |
|
243 virtual HRESULT STDMETHODCALLTYPE undo(); |
|
244 |
|
245 virtual HRESULT STDMETHODCALLTYPE redo(); |
|
246 |
|
247 virtual HRESULT STDMETHODCALLTYPE canUndo( |
|
248 /* [retval][out] */ BOOL *result); |
|
249 |
|
250 virtual HRESULT STDMETHODCALLTYPE canRedo( |
|
251 /* [retval][out] */ BOOL *result); |
|
252 |
|
253 virtual HRESULT STDMETHODCALLTYPE printFrame( |
|
254 /* [in] */ IWebView *webView, |
|
255 /* [in] */ IWebFrame *frame); |
|
256 |
|
257 virtual HRESULT STDMETHODCALLTYPE ftpDirectoryTemplatePath( |
|
258 /* [in] */ IWebView *webView, |
|
259 /* [retval][out] */ BSTR *path); |
|
260 |
|
261 virtual HRESULT STDMETHODCALLTYPE webViewHeaderHeight( |
|
262 /* [in] */ IWebView *webView, |
|
263 /* [retval][out] */ float *result); |
|
264 |
|
265 virtual HRESULT STDMETHODCALLTYPE webViewFooterHeight( |
|
266 /* [in] */ IWebView *webView, |
|
267 /* [retval][out] */ float *result); |
|
268 |
|
269 virtual HRESULT STDMETHODCALLTYPE drawHeaderInRect( |
|
270 /* [in] */ IWebView *webView, |
|
271 /* [in] */ RECT *rect, |
|
272 /* [in] */ OLE_HANDLE drawingContext); |
|
273 |
|
274 virtual HRESULT STDMETHODCALLTYPE drawFooterInRect( |
|
275 /* [in] */ IWebView *webView, |
|
276 /* [in] */ RECT *rect, |
|
277 /* [in] */ OLE_HANDLE drawingContext, |
|
278 /* [in] */ UINT pageIndex, |
|
279 /* [in] */ UINT pageCount); |
|
280 |
|
281 virtual HRESULT STDMETHODCALLTYPE webViewPrintingMarginRect( |
|
282 /* [in] */ IWebView *webView, |
|
283 /* [retval][out] */ RECT *rect); |
|
284 |
|
285 virtual HRESULT STDMETHODCALLTYPE canRunModal( |
|
286 /* [in] */ IWebView *webView, |
|
287 /* [retval][out] */ BOOL *canRunBoolean); |
|
288 |
|
289 virtual HRESULT STDMETHODCALLTYPE createModalDialog( |
|
290 /* [in] */ IWebView *sender, |
|
291 /* [in] */ IWebURLRequest *request, |
|
292 /* [retval][out] */ IWebView **newWebView); |
|
293 |
|
294 virtual HRESULT STDMETHODCALLTYPE runModal( |
|
295 /* [in] */ IWebView *webView); |
|
296 |
|
297 virtual HRESULT STDMETHODCALLTYPE isMenuBarVisible( |
|
298 /* [in] */ IWebView *webView, |
|
299 /* [retval][out] */ BOOL *visible); |
|
300 |
|
301 virtual HRESULT STDMETHODCALLTYPE setMenuBarVisible( |
|
302 /* [in] */ IWebView *webView, |
|
303 /* [in] */ BOOL visible); |
|
304 |
|
305 virtual HRESULT STDMETHODCALLTYPE runDatabaseSizeLimitPrompt( |
|
306 /* [in] */ IWebView *webView, |
|
307 /* [in] */ BSTR displayName, |
|
308 /* [in] */ IWebFrame *initiatedByFrame, |
|
309 /* [retval][out] */ BOOL *allowed); |
|
310 |
|
311 virtual HRESULT STDMETHODCALLTYPE paintCustomScrollbar( |
|
312 /* [in] */ IWebView *webView, |
|
313 /* [in] */ HDC hDC, |
|
314 /* [in] */ RECT rect, |
|
315 /* [in] */ WebScrollBarControlSize size, |
|
316 /* [in] */ WebScrollbarControlState state, |
|
317 /* [in] */ WebScrollbarControlPart pressedPart, |
|
318 /* [in] */ BOOL vertical, |
|
319 /* [in] */ float value, |
|
320 /* [in] */ float proportion, |
|
321 /* [in] */ WebScrollbarControlPartMask parts); |
|
322 |
|
323 virtual HRESULT STDMETHODCALLTYPE paintCustomScrollCorner( |
|
324 /* [in] */ IWebView *webView, |
|
325 /* [in] */ HDC hDC, |
|
326 /* [in] */ RECT rect); |
|
327 |
|
328 virtual HRESULT STDMETHODCALLTYPE createWebViewWithRequest(IWebView* sender, IWebURLRequest* request, IPropertyBag* windowFeatures, IWebView** newWebView); |
|
329 |
|
330 virtual HRESULT STDMETHODCALLTYPE drawBackground(IWebView* sender, OLE_HANDLE hdc, const RECT* dirtyRect); |
|
331 |
|
332 virtual HRESULT STDMETHODCALLTYPE decidePolicyForGeolocationRequest(IWebView* sender, IWebFrame* frame, IWebSecurityOrigin* origin, IWebGeolocationPolicyListener* listener); |
|
333 |
|
334 virtual HRESULT STDMETHODCALLTYPE didPressMissingPluginButton(IDOMElement*); |
|
335 |
|
336 protected: |
|
337 // IWebUIDelegatePrivate |
|
338 |
|
339 virtual HRESULT STDMETHODCALLTYPE unused1() { return E_NOTIMPL; } |
|
340 |
|
341 virtual HRESULT STDMETHODCALLTYPE unused2() { return E_NOTIMPL; } |
|
342 |
|
343 virtual HRESULT STDMETHODCALLTYPE unused3() { return E_NOTIMPL; } |
|
344 |
|
345 virtual HRESULT STDMETHODCALLTYPE webViewScrolled( |
|
346 /* [in] */ IWebView *sender) { return E_NOTIMPL; } |
|
347 |
|
348 virtual HRESULT STDMETHODCALLTYPE webViewAddMessageToConsole( |
|
349 /* [in] */ IWebView *sender, |
|
350 /* [in] */ BSTR message, |
|
351 /* [in] */ int lineNumber, |
|
352 /* [in] */ BSTR url, |
|
353 /* [in] */ BOOL isError); |
|
354 |
|
355 virtual HRESULT STDMETHODCALLTYPE webViewShouldInterruptJavaScript( |
|
356 /* [in] */ IWebView *sender, |
|
357 /* [retval][out] */ BOOL *result) { return E_NOTIMPL; } |
|
358 |
|
359 virtual HRESULT STDMETHODCALLTYPE webViewReceivedFocus( |
|
360 /* [in] */ IWebView *sender) { return E_NOTIMPL; } |
|
361 |
|
362 virtual HRESULT STDMETHODCALLTYPE webViewLostFocus( |
|
363 /* [in] */ IWebView *sender, |
|
364 /* [in] */ OLE_HANDLE loseFocusTo) { return E_NOTIMPL; } |
|
365 |
|
366 virtual HRESULT STDMETHODCALLTYPE doDragDrop( |
|
367 /* [in] */ IWebView *sender, |
|
368 /* [in] */ IDataObject *dataObject, |
|
369 /* [in] */ IDropSource *dropSource, |
|
370 /* [in] */ DWORD okEffect, |
|
371 /* [retval][out] */ DWORD *performedEffect); |
|
372 |
|
373 virtual HRESULT STDMETHODCALLTYPE webViewGetDlgCode( |
|
374 /* [in] */ IWebView *sender, |
|
375 /* [in] */ UINT keyCode, |
|
376 /* [retval][out] */ LONG_PTR *code); |
|
377 |
|
378 virtual HRESULT STDMETHODCALLTYPE webViewPainted( |
|
379 /* [in] */ IWebView *sender); |
|
380 |
|
381 virtual HRESULT STDMETHODCALLTYPE exceededDatabaseQuota( |
|
382 /* [in] */ IWebView *sender, |
|
383 /* [in] */ IWebFrame *frame, |
|
384 /* [in] */ IWebSecurityOrigin *origin, |
|
385 /* [in] */ BSTR databaseIdentifier); |
|
386 |
|
387 virtual HRESULT STDMETHODCALLTYPE embeddedViewWithArguments( |
|
388 /* [in] */ IWebView *sender, |
|
389 /* [in] */ IWebFrame *frame, |
|
390 /* [in] */ IPropertyBag *arguments, |
|
391 /* [retval][out] */ IWebEmbeddedView **view); |
|
392 |
|
393 virtual HRESULT STDMETHODCALLTYPE webViewClosing( |
|
394 /* [in] */ IWebView *sender); |
|
395 |
|
396 virtual HRESULT STDMETHODCALLTYPE webViewSetCursor( |
|
397 /* [in] */ IWebView *sender, |
|
398 /* [in] */ OLE_HANDLE cursor); |
|
399 |
|
400 virtual HRESULT STDMETHODCALLTYPE webViewDidInvalidate( |
|
401 /* [in] */ IWebView *sender); |
|
402 |
|
403 virtual HRESULT STDMETHODCALLTYPE desktopNotificationsDelegate( |
|
404 /* [out] */ IWebDesktopNotificationsDelegate** result); |
|
405 |
|
406 ULONG m_refCount; |
|
407 |
|
408 private: |
|
409 RECT m_frame; |
|
410 OwnPtr<DRTUndoManager> m_undoManager; |
|
411 |
|
412 COMPtr<IWebDesktopNotificationsDelegate> m_desktopNotifications; |
|
413 }; |
|
414 |
|
415 #endif |