UIDelegate.h 16 KB

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