• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 <WebKit/WebKit.h>
33 #include <wtf/OwnPtr.h>
34 #include <windef.h>
35 
36 class DRTUndoManager;
37 
38 class UIDelegate : public IWebUIDelegate, IWebUIDelegatePrivate3 {
39 public:
40     UIDelegate();
41 
42     void resetUndoManager();
43 
44     // IUnknown
45     virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
46     virtual ULONG STDMETHODCALLTYPE AddRef(void);
47     virtual ULONG STDMETHODCALLTYPE Release(void);
48 
49     // IWebUIDelegate
50     virtual HRESULT STDMETHODCALLTYPE createWebViewWithRequest(
51         /* [in] */ IWebView *sender,
52         /* [in] */ IWebURLRequest *request,
53         /* [retval][out] */ IWebView **newWebView);
54 
webViewShow(IWebView * sender)55     virtual HRESULT STDMETHODCALLTYPE webViewShow(
56         /* [in] */ IWebView *sender) { return E_NOTIMPL; }
57 
58     virtual HRESULT STDMETHODCALLTYPE webViewClose(
59         /* [in] */ IWebView *sender);
60 
61     virtual HRESULT STDMETHODCALLTYPE webViewFocus(
62         /* [in] */ IWebView *sender);
63 
64     virtual HRESULT STDMETHODCALLTYPE webViewUnfocus(
65         /* [in] */ IWebView *sender);
66 
webViewFirstResponder(IWebView * sender,OLE_HANDLE * responder)67     virtual HRESULT STDMETHODCALLTYPE webViewFirstResponder(
68         /* [in] */ IWebView *sender,
69         /* [retval][out] */ OLE_HANDLE *responder) { return E_NOTIMPL; }
70 
makeFirstResponder(IWebView * sender,OLE_HANDLE responder)71     virtual HRESULT STDMETHODCALLTYPE makeFirstResponder(
72         /* [in] */ IWebView *sender,
73         /* [in] */ OLE_HANDLE responder) { return E_NOTIMPL; }
74 
75     virtual HRESULT STDMETHODCALLTYPE setStatusText(
76         /* [in] */ IWebView *sender,
77         /* [in] */ BSTR text);
78 
webViewStatusText(IWebView * sender,BSTR * text)79     virtual HRESULT STDMETHODCALLTYPE webViewStatusText(
80         /* [in] */ IWebView *sender,
81         /* [retval][out] */ BSTR *text) { return E_NOTIMPL; }
82 
webViewAreToolbarsVisible(IWebView * sender,BOOL * visible)83     virtual HRESULT STDMETHODCALLTYPE webViewAreToolbarsVisible(
84         /* [in] */ IWebView *sender,
85         /* [retval][out] */ BOOL *visible) { return E_NOTIMPL; }
86 
setToolbarsVisible(IWebView * sender,BOOL visible)87     virtual HRESULT STDMETHODCALLTYPE setToolbarsVisible(
88         /* [in] */ IWebView *sender,
89         /* [in] */ BOOL visible) { return E_NOTIMPL; }
90 
webViewIsStatusBarVisible(IWebView * sender,BOOL * visible)91     virtual HRESULT STDMETHODCALLTYPE webViewIsStatusBarVisible(
92         /* [in] */ IWebView *sender,
93         /* [retval][out] */ BOOL *visible) { return E_NOTIMPL; }
94 
setStatusBarVisible(IWebView * sender,BOOL visible)95     virtual HRESULT STDMETHODCALLTYPE setStatusBarVisible(
96         /* [in] */ IWebView *sender,
97         /* [in] */ BOOL visible) { return E_NOTIMPL; }
98 
webViewIsResizable(IWebView * sender,BOOL * resizable)99     virtual HRESULT STDMETHODCALLTYPE webViewIsResizable(
100         /* [in] */ IWebView *sender,
101         /* [retval][out] */ BOOL *resizable) { return E_NOTIMPL; }
102 
setResizable(IWebView * sender,BOOL resizable)103     virtual HRESULT STDMETHODCALLTYPE setResizable(
104         /* [in] */ IWebView *sender,
105         /* [in] */ BOOL resizable) { return E_NOTIMPL; }
106 
107     virtual HRESULT STDMETHODCALLTYPE setFrame(
108         /* [in] */ IWebView *sender,
109         /* [in] */ RECT *frame);
110 
111     virtual HRESULT STDMETHODCALLTYPE webViewFrame(
112         /* [in] */ IWebView *sender,
113         /* [retval][out] */ RECT *frame);
114 
setContentRect(IWebView * sender,RECT * contentRect)115     virtual HRESULT STDMETHODCALLTYPE setContentRect(
116         /* [in] */ IWebView *sender,
117         /* [in] */ RECT *contentRect) { return E_NOTIMPL; }
118 
webViewContentRect(IWebView * sender,RECT * contentRect)119     virtual HRESULT STDMETHODCALLTYPE webViewContentRect(
120         /* [in] */ IWebView *sender,
121         /* [retval][out] */ RECT *contentRect) { return E_NOTIMPL; }
122 
123     virtual HRESULT STDMETHODCALLTYPE runJavaScriptAlertPanelWithMessage(
124         /* [in] */ IWebView *sender,
125         /* [in] */ BSTR message);
126 
127     virtual HRESULT STDMETHODCALLTYPE runJavaScriptConfirmPanelWithMessage(
128         /* [in] */ IWebView *sender,
129         /* [in] */ BSTR message,
130         /* [retval][out] */ BOOL *result);
131 
132     virtual HRESULT STDMETHODCALLTYPE runJavaScriptTextInputPanelWithPrompt(
133         /* [in] */ IWebView *sender,
134         /* [in] */ BSTR message,
135         /* [in] */ BSTR defaultText,
136         /* [retval][out] */ BSTR *result);
137 
138     virtual HRESULT STDMETHODCALLTYPE runBeforeUnloadConfirmPanelWithMessage(
139         /* [in] */ IWebView *sender,
140         /* [in] */ BSTR message,
141         /* [in] */ IWebFrame *initiatedByFrame,
142         /* [retval][out] */ BOOL *result);
143 
runOpenPanelForFileButtonWithResultListener(IWebView * sender,IWebOpenPanelResultListener * resultListener)144     virtual HRESULT STDMETHODCALLTYPE runOpenPanelForFileButtonWithResultListener(
145         /* [in] */ IWebView *sender,
146         /* [in] */ IWebOpenPanelResultListener *resultListener) { return E_NOTIMPL; }
147 
mouseDidMoveOverElement(IWebView * sender,IPropertyBag * elementInformation,UINT modifierFlags)148     virtual HRESULT STDMETHODCALLTYPE mouseDidMoveOverElement(
149         /* [in] */ IWebView *sender,
150         /* [in] */ IPropertyBag *elementInformation,
151         /* [in] */ UINT modifierFlags) { return E_NOTIMPL; }
152 
contextMenuItemsForElement(IWebView * sender,IPropertyBag * element,OLE_HANDLE defaultItems,OLE_HANDLE * resultMenu)153     virtual HRESULT STDMETHODCALLTYPE contextMenuItemsForElement(
154         /* [in] */ IWebView *sender,
155         /* [in] */ IPropertyBag *element,
156         /* [in] */ OLE_HANDLE defaultItems,
157         /* [retval][out] */ OLE_HANDLE *resultMenu) { return E_NOTIMPL; }
158 
validateUserInterfaceItem(IWebView * webView,UINT itemCommandID,BOOL defaultValidation,BOOL * isValid)159     virtual HRESULT STDMETHODCALLTYPE validateUserInterfaceItem(
160         /* [in] */ IWebView *webView,
161         /* [in] */ UINT itemCommandID,
162         /* [in] */ BOOL defaultValidation,
163         /* [retval][out] */ BOOL *isValid) { return E_NOTIMPL; }
164 
shouldPerformAction(IWebView * webView,UINT itemCommandID,UINT sender)165     virtual HRESULT STDMETHODCALLTYPE shouldPerformAction(
166         /* [in] */ IWebView *webView,
167         /* [in] */ UINT itemCommandID,
168         /* [in] */ UINT sender) { return E_NOTIMPL; }
169 
dragDestinationActionMaskForDraggingInfo(IWebView * webView,IDataObject * draggingInfo,WebDragDestinationAction * action)170     virtual HRESULT STDMETHODCALLTYPE dragDestinationActionMaskForDraggingInfo(
171         /* [in] */ IWebView *webView,
172         /* [in] */ IDataObject *draggingInfo,
173         /* [retval][out] */ WebDragDestinationAction *action) { return E_NOTIMPL; }
174 
willPerformDragDestinationAction(IWebView * webView,WebDragDestinationAction action,IDataObject * draggingInfo)175     virtual HRESULT STDMETHODCALLTYPE willPerformDragDestinationAction(
176         /* [in] */ IWebView *webView,
177         /* [in] */ WebDragDestinationAction action,
178         /* [in] */ IDataObject *draggingInfo) { return E_NOTIMPL; }
179 
dragSourceActionMaskForPoint(IWebView * webView,LPPOINT point,WebDragSourceAction * action)180     virtual HRESULT STDMETHODCALLTYPE dragSourceActionMaskForPoint(
181         /* [in] */ IWebView *webView,
182         /* [in] */ LPPOINT point,
183         /* [retval][out] */ WebDragSourceAction *action) { return E_NOTIMPL; }
184 
willPerformDragSourceAction(IWebView * webView,WebDragSourceAction action,LPPOINT point,IDataObject * pasteboard)185     virtual HRESULT STDMETHODCALLTYPE willPerformDragSourceAction(
186         /* [in] */ IWebView *webView,
187         /* [in] */ WebDragSourceAction action,
188         /* [in] */ LPPOINT point,
189         /* [in] */ IDataObject *pasteboard) { return E_NOTIMPL; }
190 
contextMenuItemSelected(IWebView * sender,void * item,IPropertyBag * element)191     virtual HRESULT STDMETHODCALLTYPE contextMenuItemSelected(
192         /* [in] */ IWebView *sender,
193         /* [in] */ void *item,
194         /* [in] */ IPropertyBag *element) { return E_NOTIMPL; }
195 
196     virtual HRESULT STDMETHODCALLTYPE hasCustomMenuImplementation(
197         /* [retval][out] */ BOOL *hasCustomMenus);
198 
199     virtual HRESULT STDMETHODCALLTYPE trackCustomPopupMenu(
200         /* [in] */ IWebView *sender,
201         /* [in] */ OLE_HANDLE menu,
202         /* [in] */ LPPOINT point);
203 
measureCustomMenuItem(IWebView * sender,void * measureItem)204     virtual HRESULT STDMETHODCALLTYPE measureCustomMenuItem(
205         /* [in] */ IWebView *sender,
206         /* [in] */ void *measureItem) { return E_NOTIMPL; }
207 
drawCustomMenuItem(IWebView * sender,void * drawItem)208     virtual HRESULT STDMETHODCALLTYPE drawCustomMenuItem(
209         /* [in] */ IWebView *sender,
210         /* [in] */ void *drawItem) { return E_NOTIMPL; }
211 
addCustomMenuDrawingData(IWebView * sender,OLE_HANDLE menu)212     virtual HRESULT STDMETHODCALLTYPE addCustomMenuDrawingData(
213         /* [in] */ IWebView *sender,
214         /* [in] */ OLE_HANDLE menu) { return E_NOTIMPL; }
215 
cleanUpCustomMenuDrawingData(IWebView * sender,OLE_HANDLE menu)216     virtual HRESULT STDMETHODCALLTYPE cleanUpCustomMenuDrawingData(
217         /* [in] */ IWebView *sender,
218         /* [in] */ OLE_HANDLE menu) { return E_NOTIMPL; }
219 
canTakeFocus(IWebView * sender,BOOL forward,BOOL * result)220     virtual HRESULT STDMETHODCALLTYPE canTakeFocus(
221         /* [in] */ IWebView *sender,
222         /* [in] */ BOOL forward,
223         /* [out] */ BOOL *result) { return E_NOTIMPL; }
224 
takeFocus(IWebView * sender,BOOL forward)225     virtual HRESULT STDMETHODCALLTYPE takeFocus(
226         /* [in] */ IWebView *sender,
227         /* [in] */ BOOL forward) { return E_NOTIMPL; }
228 
229     virtual HRESULT STDMETHODCALLTYPE registerUndoWithTarget(
230         /* [in] */ IWebUndoTarget *target,
231         /* [in] */ BSTR actionName,
232         /* [in] */ IUnknown *actionArg);
233 
234     virtual HRESULT STDMETHODCALLTYPE removeAllActionsWithTarget(
235         /* [in] */ IWebUndoTarget *target);
236 
237     virtual HRESULT STDMETHODCALLTYPE setActionTitle(
238         /* [in] */ BSTR actionTitle);
239 
240     virtual HRESULT STDMETHODCALLTYPE undo();
241 
242     virtual HRESULT STDMETHODCALLTYPE redo();
243 
244     virtual HRESULT STDMETHODCALLTYPE canUndo(
245         /* [retval][out] */ BOOL *result);
246 
247     virtual HRESULT STDMETHODCALLTYPE canRedo(
248         /* [retval][out] */ BOOL *result);
249 
250 protected:
251     // IWebUIDelegatePrivate
252 
webViewResizerRect(IWebView * sender,RECT * rect)253     virtual HRESULT STDMETHODCALLTYPE webViewResizerRect(
254         /* [in] */ IWebView *sender,
255         /* [retval][out] */ RECT *rect) { return E_NOTIMPL; }
256 
webViewSendResizeMessage(UINT uMsg,WPARAM wParam,LPARAM lParam)257     virtual HRESULT STDMETHODCALLTYPE webViewSendResizeMessage(
258         /* [in] */ UINT uMsg,
259         /* [in] */ WPARAM wParam,
260         /* [in] */ LPARAM lParam) { return E_NOTIMPL; }
261 
webViewDrawResizer(IWebView * sender,HDC dc,BOOL overlapsContent,RECT * rect)262     virtual HRESULT STDMETHODCALLTYPE webViewDrawResizer(
263         /* [in] */ IWebView *sender,
264         /* [in] */ HDC dc,
265         /* [in] */ BOOL overlapsContent,
266         /* [in] */ RECT *rect) { return E_NOTIMPL; }
267 
webViewScrolled(IWebView * sender)268     virtual HRESULT STDMETHODCALLTYPE webViewScrolled(
269         /* [in] */ IWebView *sender) { return E_NOTIMPL; }
270 
271     virtual HRESULT STDMETHODCALLTYPE webViewAddMessageToConsole(
272         /* [in] */ IWebView *sender,
273         /* [in] */ BSTR message,
274         /* [in] */ int lineNumber,
275         /* [in] */ BSTR url,
276         /* [in] */ BOOL isError);
277 
webViewShouldInterruptJavaScript(IWebView * sender,BOOL * result)278     virtual HRESULT STDMETHODCALLTYPE webViewShouldInterruptJavaScript(
279         /* [in] */ IWebView *sender,
280         /* [retval][out] */ BOOL *result) { return E_NOTIMPL; }
281 
webViewReceivedFocus(IWebView * sender)282     virtual HRESULT STDMETHODCALLTYPE webViewReceivedFocus(
283         /* [in] */ IWebView *sender) { return E_NOTIMPL; }
284 
webViewLostFocus(IWebView * sender,OLE_HANDLE loseFocusTo)285     virtual HRESULT STDMETHODCALLTYPE webViewLostFocus(
286         /* [in] */ IWebView *sender,
287         /* [in] */ OLE_HANDLE loseFocusTo) { return E_NOTIMPL; }
288 
289     virtual HRESULT STDMETHODCALLTYPE doDragDrop(
290         /* [in] */ IWebView *sender,
291         /* [in] */ IDataObject *dataObject,
292         /* [in] */ IDropSource *dropSource,
293         /* [in] */ DWORD okEffect,
294         /* [retval][out] */ DWORD *performedEffect);
295 
296     virtual HRESULT STDMETHODCALLTYPE webViewGetDlgCode(
297         /* [in] */ IWebView *sender,
298         /* [in] */ UINT keyCode,
299         /* [retval][out] */ LONG_PTR *code);
300 
301     // IWebUIDelegatePrivate2
302 
303     virtual HRESULT STDMETHODCALLTYPE webViewPainted(
304         /* [in] */ IWebView *sender);
305 
306     // IWebUIDelegatePrivate3
307 
308     virtual HRESULT STDMETHODCALLTYPE exceededDatabaseQuota(
309         /* [in] */ IWebView *sender,
310         /* [in] */ IWebFrame *frame,
311         /* [in] */ IWebSecurityOrigin *origin,
312         /* [in] */ BSTR databaseIdentifier);
313 
314     ULONG                   m_refCount;
315 
316 private:
317     RECT m_frame;
318     OwnPtr<DRTUndoManager> m_undoManager;
319 };
320 
321 #endif
322