UIDelegate.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668
  1. /*
  2. * Copyright (C) 2005, 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. *
  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. #include "config.h"
  29. #include "UIDelegate.h"
  30. #include "DumpRenderTree.h"
  31. #include "DraggingInfo.h"
  32. #include "EventSender.h"
  33. #include "DRTDesktopNotificationPresenter.h"
  34. #include "TestRunner.h"
  35. #include <WebCore/COMPtr.h>
  36. #include <wtf/Assertions.h>
  37. #include <wtf/PassOwnPtr.h>
  38. #include <wtf/Platform.h>
  39. #include <wtf/Vector.h>
  40. #include <JavaScriptCore/JavaScriptCore.h>
  41. #include <WebKit/WebKit.h>
  42. #include <stdio.h>
  43. using std::wstring;
  44. class DRTUndoObject {
  45. public:
  46. DRTUndoObject(IWebUndoTarget* target, BSTR actionName, IUnknown* obj)
  47. : m_target(target)
  48. , m_actionName(SysAllocString(actionName))
  49. , m_obj(obj)
  50. {
  51. }
  52. ~DRTUndoObject()
  53. {
  54. SysFreeString(m_actionName);
  55. }
  56. void invoke()
  57. {
  58. m_target->invoke(m_actionName, m_obj.get());
  59. }
  60. private:
  61. IWebUndoTarget* m_target;
  62. BSTR m_actionName;
  63. COMPtr<IUnknown> m_obj;
  64. };
  65. class DRTUndoStack {
  66. public:
  67. ~DRTUndoStack() { deleteAllValues(m_undoVector); }
  68. bool isEmpty() const { return m_undoVector.isEmpty(); }
  69. void clear() { deleteAllValues(m_undoVector); m_undoVector.clear(); }
  70. void push(DRTUndoObject* undoObject) { m_undoVector.append(undoObject); }
  71. DRTUndoObject* pop() { DRTUndoObject* top = m_undoVector.last(); m_undoVector.removeLast(); return top; }
  72. private:
  73. Vector<DRTUndoObject*> m_undoVector;
  74. };
  75. class DRTUndoManager {
  76. public:
  77. DRTUndoManager();
  78. void removeAllActions();
  79. void registerUndoWithTarget(IWebUndoTarget* target, BSTR actionName, IUnknown* obj);
  80. void redo();
  81. void undo();
  82. bool canRedo() { return !m_redoStack->isEmpty(); }
  83. bool canUndo() { return !m_undoStack->isEmpty(); }
  84. private:
  85. OwnPtr<DRTUndoStack> m_redoStack;
  86. OwnPtr<DRTUndoStack> m_undoStack;
  87. bool m_isRedoing;
  88. bool m_isUndoing;
  89. };
  90. DRTUndoManager::DRTUndoManager()
  91. : m_redoStack(adoptPtr(new DRTUndoStack))
  92. , m_undoStack(adoptPtr(new DRTUndoStack))
  93. , m_isRedoing(false)
  94. , m_isUndoing(false)
  95. {
  96. }
  97. void DRTUndoManager::removeAllActions()
  98. {
  99. m_redoStack->clear();
  100. m_undoStack->clear();
  101. }
  102. void DRTUndoManager::registerUndoWithTarget(IWebUndoTarget* target, BSTR actionName, IUnknown* obj)
  103. {
  104. if (!m_isUndoing && !m_isRedoing)
  105. m_redoStack->clear();
  106. DRTUndoStack* stack = m_isUndoing ? m_redoStack.get() : m_undoStack.get();
  107. stack->push(new DRTUndoObject(target, actionName, obj));
  108. }
  109. void DRTUndoManager::redo()
  110. {
  111. if (!canRedo())
  112. return;
  113. m_isRedoing = true;
  114. DRTUndoObject* redoObject = m_redoStack->pop();
  115. redoObject->invoke();
  116. delete redoObject;
  117. m_isRedoing = false;
  118. }
  119. void DRTUndoManager::undo()
  120. {
  121. if (!canUndo())
  122. return;
  123. m_isUndoing = true;
  124. DRTUndoObject* undoObject = m_undoStack->pop();
  125. undoObject->invoke();
  126. delete undoObject;
  127. m_isUndoing = false;
  128. }
  129. UIDelegate::UIDelegate()
  130. : m_refCount(1)
  131. , m_undoManager(adoptPtr(new DRTUndoManager))
  132. , m_desktopNotifications(new DRTDesktopNotificationPresenter)
  133. {
  134. m_frame.bottom = 0;
  135. m_frame.top = 0;
  136. m_frame.left = 0;
  137. m_frame.right = 0;
  138. }
  139. void UIDelegate::resetUndoManager()
  140. {
  141. m_undoManager = adoptPtr(new DRTUndoManager);
  142. }
  143. HRESULT STDMETHODCALLTYPE UIDelegate::QueryInterface(REFIID riid, void** ppvObject)
  144. {
  145. *ppvObject = 0;
  146. if (IsEqualGUID(riid, IID_IUnknown))
  147. *ppvObject = static_cast<IWebUIDelegate*>(this);
  148. else if (IsEqualGUID(riid, IID_IWebUIDelegate))
  149. *ppvObject = static_cast<IWebUIDelegate*>(this);
  150. else if (IsEqualGUID(riid, IID_IWebUIDelegate2))
  151. *ppvObject = static_cast<IWebUIDelegate2*>(this);
  152. else if (IsEqualGUID(riid, IID_IWebUIDelegatePrivate))
  153. *ppvObject = static_cast<IWebUIDelegatePrivate*>(this);
  154. else if (IsEqualGUID(riid, IID_IWebUIDelegatePrivate2))
  155. *ppvObject = static_cast<IWebUIDelegatePrivate2*>(this);
  156. else if (IsEqualGUID(riid, IID_IWebUIDelegatePrivate3))
  157. *ppvObject = static_cast<IWebUIDelegatePrivate3*>(this);
  158. else
  159. return E_NOINTERFACE;
  160. AddRef();
  161. return S_OK;
  162. }
  163. ULONG STDMETHODCALLTYPE UIDelegate::AddRef()
  164. {
  165. return ++m_refCount;
  166. }
  167. ULONG STDMETHODCALLTYPE UIDelegate::Release()
  168. {
  169. ULONG newRef = --m_refCount;
  170. if (!newRef)
  171. delete(this);
  172. return newRef;
  173. }
  174. HRESULT STDMETHODCALLTYPE UIDelegate::hasCustomMenuImplementation(
  175. /* [retval][out] */ BOOL *hasCustomMenus)
  176. {
  177. *hasCustomMenus = TRUE;
  178. return S_OK;
  179. }
  180. HRESULT STDMETHODCALLTYPE UIDelegate::trackCustomPopupMenu(
  181. /* [in] */ IWebView *sender,
  182. /* [in] */ OLE_HANDLE menu,
  183. /* [in] */ LPPOINT point)
  184. {
  185. // Do nothing
  186. return S_OK;
  187. }
  188. HRESULT STDMETHODCALLTYPE UIDelegate::registerUndoWithTarget(
  189. /* [in] */ IWebUndoTarget* target,
  190. /* [in] */ BSTR actionName,
  191. /* [in] */ IUnknown* actionArg)
  192. {
  193. m_undoManager->registerUndoWithTarget(target, actionName, actionArg);
  194. return S_OK;
  195. }
  196. HRESULT STDMETHODCALLTYPE UIDelegate::removeAllActionsWithTarget(
  197. /* [in] */ IWebUndoTarget*)
  198. {
  199. m_undoManager->removeAllActions();
  200. return S_OK;
  201. }
  202. HRESULT STDMETHODCALLTYPE UIDelegate::setActionTitle(
  203. /* [in] */ BSTR actionTitle)
  204. {
  205. // It is not neccessary to implement this for DRT because there is
  206. // menu to write out the title to.
  207. return S_OK;
  208. }
  209. HRESULT STDMETHODCALLTYPE UIDelegate::undo()
  210. {
  211. m_undoManager->undo();
  212. return S_OK;
  213. }
  214. HRESULT STDMETHODCALLTYPE UIDelegate::redo()
  215. {
  216. m_undoManager->redo();
  217. return S_OK;
  218. }
  219. HRESULT STDMETHODCALLTYPE UIDelegate::canUndo(
  220. /* [retval][out] */ BOOL* result)
  221. {
  222. if (!result)
  223. return E_POINTER;
  224. *result = m_undoManager->canUndo();
  225. return S_OK;
  226. }
  227. HRESULT STDMETHODCALLTYPE UIDelegate::canRedo(
  228. /* [retval][out] */ BOOL* result)
  229. {
  230. if (!result)
  231. return E_POINTER;
  232. *result = m_undoManager->canRedo();
  233. return S_OK;
  234. }
  235. HRESULT STDMETHODCALLTYPE UIDelegate::printFrame(
  236. /* [in] */ IWebView *webView,
  237. /* [in] */ IWebFrame *frame)
  238. {
  239. return E_NOTIMPL;
  240. }
  241. HRESULT STDMETHODCALLTYPE UIDelegate::ftpDirectoryTemplatePath(
  242. /* [in] */ IWebView *webView,
  243. /* [retval][out] */ BSTR *path)
  244. {
  245. if (!path)
  246. return E_POINTER;
  247. *path = 0;
  248. return E_NOTIMPL;
  249. }
  250. HRESULT STDMETHODCALLTYPE UIDelegate::webViewHeaderHeight(
  251. /* [in] */ IWebView *webView,
  252. /* [retval][out] */ float *result)
  253. {
  254. if (!result)
  255. return E_POINTER;
  256. *result = 0;
  257. return E_NOTIMPL;
  258. }
  259. HRESULT STDMETHODCALLTYPE UIDelegate::webViewFooterHeight(
  260. /* [in] */ IWebView *webView,
  261. /* [retval][out] */ float *result)
  262. {
  263. if (!result)
  264. return E_POINTER;
  265. *result = 0;
  266. return E_NOTIMPL;
  267. }
  268. HRESULT STDMETHODCALLTYPE UIDelegate::drawHeaderInRect(
  269. /* [in] */ IWebView *webView,
  270. /* [in] */ RECT *rect,
  271. /* [in] */ OLE_HANDLE drawingContext)
  272. {
  273. return E_NOTIMPL;
  274. }
  275. HRESULT STDMETHODCALLTYPE UIDelegate::drawFooterInRect(
  276. /* [in] */ IWebView *webView,
  277. /* [in] */ RECT *rect,
  278. /* [in] */ OLE_HANDLE drawingContext,
  279. /* [in] */ UINT pageIndex,
  280. /* [in] */ UINT pageCount)
  281. {
  282. return E_NOTIMPL;
  283. }
  284. HRESULT STDMETHODCALLTYPE UIDelegate::webViewPrintingMarginRect(
  285. /* [in] */ IWebView *webView,
  286. /* [retval][out] */ RECT *rect)
  287. {
  288. return E_NOTIMPL;
  289. }
  290. HRESULT STDMETHODCALLTYPE UIDelegate::canRunModal(
  291. /* [in] */ IWebView *webView,
  292. /* [retval][out] */ BOOL *canRunBoolean)
  293. {
  294. return E_NOTIMPL;
  295. }
  296. HRESULT STDMETHODCALLTYPE UIDelegate::createModalDialog(
  297. /* [in] */ IWebView *sender,
  298. /* [in] */ IWebURLRequest *request,
  299. /* [retval][out] */ IWebView **newWebView)
  300. {
  301. return E_NOTIMPL;
  302. }
  303. HRESULT STDMETHODCALLTYPE UIDelegate::runModal(
  304. /* [in] */ IWebView *webView)
  305. {
  306. return E_NOTIMPL;
  307. }
  308. HRESULT STDMETHODCALLTYPE UIDelegate::isMenuBarVisible(
  309. /* [in] */ IWebView *webView,
  310. /* [retval][out] */ BOOL *visible)
  311. {
  312. if (!visible)
  313. return E_POINTER;
  314. *visible = false;
  315. return E_NOTIMPL;
  316. }
  317. HRESULT STDMETHODCALLTYPE UIDelegate::setMenuBarVisible(
  318. /* [in] */ IWebView *webView,
  319. /* [in] */ BOOL visible)
  320. {
  321. return E_NOTIMPL;
  322. }
  323. HRESULT STDMETHODCALLTYPE UIDelegate::runDatabaseSizeLimitPrompt(
  324. /* [in] */ IWebView *webView,
  325. /* [in] */ BSTR displayName,
  326. /* [in] */ IWebFrame *initiatedByFrame,
  327. /* [retval][out] */ BOOL *allowed)
  328. {
  329. if (!allowed)
  330. return E_POINTER;
  331. *allowed = false;
  332. return E_NOTIMPL;
  333. }
  334. HRESULT STDMETHODCALLTYPE UIDelegate::paintCustomScrollbar(
  335. /* [in] */ IWebView *webView,
  336. /* [in] */ HDC hDC,
  337. /* [in] */ RECT rect,
  338. /* [in] */ WebScrollBarControlSize size,
  339. /* [in] */ WebScrollbarControlState state,
  340. /* [in] */ WebScrollbarControlPart pressedPart,
  341. /* [in] */ BOOL vertical,
  342. /* [in] */ float value,
  343. /* [in] */ float proportion,
  344. /* [in] */ WebScrollbarControlPartMask parts)
  345. {
  346. return E_NOTIMPL;
  347. }
  348. HRESULT STDMETHODCALLTYPE UIDelegate::paintCustomScrollCorner(
  349. /* [in] */ IWebView *webView,
  350. /* [in] */ HDC hDC,
  351. /* [in] */ RECT rect)
  352. {
  353. return E_NOTIMPL;
  354. }
  355. HRESULT STDMETHODCALLTYPE UIDelegate::setFrame(
  356. /* [in] */ IWebView* /*sender*/,
  357. /* [in] */ RECT* frame)
  358. {
  359. m_frame = *frame;
  360. return S_OK;
  361. }
  362. HRESULT STDMETHODCALLTYPE UIDelegate::webViewFrame(
  363. /* [in] */ IWebView* /*sender*/,
  364. /* [retval][out] */ RECT* frame)
  365. {
  366. *frame = m_frame;
  367. return S_OK;
  368. }
  369. HRESULT STDMETHODCALLTYPE UIDelegate::runJavaScriptAlertPanelWithMessage(
  370. /* [in] */ IWebView* /*sender*/,
  371. /* [in] */ BSTR message)
  372. {
  373. printf("ALERT: %S\n", message ? message : L"");
  374. fflush(stdout);
  375. return S_OK;
  376. }
  377. HRESULT STDMETHODCALLTYPE UIDelegate::runJavaScriptConfirmPanelWithMessage(
  378. /* [in] */ IWebView* sender,
  379. /* [in] */ BSTR message,
  380. /* [retval][out] */ BOOL* result)
  381. {
  382. printf("CONFIRM: %S\n", message ? message : L"");
  383. *result = TRUE;
  384. return S_OK;
  385. }
  386. HRESULT STDMETHODCALLTYPE UIDelegate::runJavaScriptTextInputPanelWithPrompt(
  387. /* [in] */ IWebView *sender,
  388. /* [in] */ BSTR message,
  389. /* [in] */ BSTR defaultText,
  390. /* [retval][out] */ BSTR *result)
  391. {
  392. printf("PROMPT: %S, default text: %S\n", message ? message : L"", defaultText ? defaultText : L"");
  393. *result = SysAllocString(defaultText);
  394. return S_OK;
  395. }
  396. HRESULT STDMETHODCALLTYPE UIDelegate::runBeforeUnloadConfirmPanelWithMessage(
  397. /* [in] */ IWebView* /*sender*/,
  398. /* [in] */ BSTR message,
  399. /* [in] */ IWebFrame* /*initiatedByFrame*/,
  400. /* [retval][out] */ BOOL* result)
  401. {
  402. if (!result)
  403. return E_POINTER;
  404. printf("CONFIRM NAVIGATION: %S\n", message ? message : L"");
  405. *result = !gTestRunner->shouldStayOnPageAfterHandlingBeforeUnload();
  406. return S_OK;
  407. }
  408. HRESULT STDMETHODCALLTYPE UIDelegate::webViewAddMessageToConsole(
  409. /* [in] */ IWebView* sender,
  410. /* [in] */ BSTR message,
  411. /* [in] */ int lineNumber,
  412. /* [in] */ BSTR url,
  413. /* [in] */ BOOL isError)
  414. {
  415. wstring newMessage;
  416. if (message) {
  417. newMessage = message;
  418. size_t fileProtocol = newMessage.find(L"file://");
  419. if (fileProtocol != wstring::npos)
  420. newMessage = newMessage.substr(0, fileProtocol) + lastPathComponent(newMessage.substr(fileProtocol));
  421. }
  422. printf("CONSOLE MESSAGE: ");
  423. if (lineNumber)
  424. printf("line %d: ", lineNumber);
  425. printf("%s\n", toUTF8(newMessage).c_str());
  426. return S_OK;
  427. }
  428. HRESULT STDMETHODCALLTYPE UIDelegate::doDragDrop(
  429. /* [in] */ IWebView* sender,
  430. /* [in] */ IDataObject* object,
  431. /* [in] */ IDropSource* source,
  432. /* [in] */ DWORD okEffect,
  433. /* [retval][out] */ DWORD* performedEffect)
  434. {
  435. if (!performedEffect)
  436. return E_POINTER;
  437. *performedEffect = 0;
  438. draggingInfo = new DraggingInfo(object, source);
  439. HRESULT oleDragAndDropReturnValue = DRAGDROP_S_CANCEL;
  440. replaySavedEvents(&oleDragAndDropReturnValue);
  441. if (draggingInfo) {
  442. *performedEffect = draggingInfo->performedDropEffect();
  443. delete draggingInfo;
  444. draggingInfo = 0;
  445. }
  446. return oleDragAndDropReturnValue;
  447. }
  448. HRESULT STDMETHODCALLTYPE UIDelegate::webViewGetDlgCode(
  449. /* [in] */ IWebView* /*sender*/,
  450. /* [in] */ UINT /*keyCode*/,
  451. /* [retval][out] */ LONG_PTR *code)
  452. {
  453. if (!code)
  454. return E_POINTER;
  455. *code = 0;
  456. return E_NOTIMPL;
  457. }
  458. HRESULT STDMETHODCALLTYPE UIDelegate::createWebViewWithRequest(
  459. /* [in] */ IWebView *sender,
  460. /* [in] */ IWebURLRequest *request,
  461. /* [retval][out] */ IWebView **newWebView)
  462. {
  463. if (!::gTestRunner->canOpenWindows())
  464. return E_FAIL;
  465. *newWebView = createWebViewAndOffscreenWindow();
  466. return S_OK;
  467. }
  468. HRESULT STDMETHODCALLTYPE UIDelegate::webViewClose(
  469. /* [in] */ IWebView *sender)
  470. {
  471. HWND hostWindow;
  472. sender->hostWindow(reinterpret_cast<OLE_HANDLE*>(&hostWindow));
  473. DestroyWindow(hostWindow);
  474. return S_OK;
  475. }
  476. HRESULT STDMETHODCALLTYPE UIDelegate::webViewFocus(
  477. /* [in] */ IWebView *sender)
  478. {
  479. HWND hostWindow;
  480. sender->hostWindow(reinterpret_cast<OLE_HANDLE*>(&hostWindow));
  481. SetForegroundWindow(hostWindow);
  482. return S_OK;
  483. }
  484. HRESULT STDMETHODCALLTYPE UIDelegate::webViewUnfocus(
  485. /* [in] */ IWebView *sender)
  486. {
  487. SetForegroundWindow(GetDesktopWindow());
  488. return S_OK;
  489. }
  490. HRESULT STDMETHODCALLTYPE UIDelegate::webViewPainted(
  491. /* [in] */ IWebView *sender)
  492. {
  493. return S_OK;
  494. }
  495. HRESULT STDMETHODCALLTYPE UIDelegate::exceededDatabaseQuota(
  496. /* [in] */ IWebView *sender,
  497. /* [in] */ IWebFrame *frame,
  498. /* [in] */ IWebSecurityOrigin *origin,
  499. /* [in] */ BSTR databaseIdentifier)
  500. {
  501. BSTR protocol;
  502. BSTR host;
  503. unsigned short port;
  504. origin->protocol(&protocol);
  505. origin->host(&host);
  506. origin->port(&port);
  507. if (!done && gTestRunner->dumpDatabaseCallbacks())
  508. printf("UI DELEGATE DATABASE CALLBACK: exceededDatabaseQuotaForSecurityOrigin:{%S, %S, %i} database:%S\n", protocol, host, port, databaseIdentifier);
  509. SysFreeString(protocol);
  510. SysFreeString(host);
  511. static const unsigned long long defaultQuota = 5 * 1024 * 1024;
  512. origin->setQuota(defaultQuota);
  513. return S_OK;
  514. }
  515. HRESULT STDMETHODCALLTYPE UIDelegate::embeddedViewWithArguments(
  516. /* [in] */ IWebView *sender,
  517. /* [in] */ IWebFrame *frame,
  518. /* [in] */ IPropertyBag *arguments,
  519. /* [retval][out] */ IWebEmbeddedView **view)
  520. {
  521. if (!view)
  522. return E_POINTER;
  523. *view = 0;
  524. return E_NOTIMPL;
  525. }
  526. HRESULT STDMETHODCALLTYPE UIDelegate::webViewClosing(
  527. /* [in] */ IWebView *sender)
  528. {
  529. return E_NOTIMPL;
  530. }
  531. HRESULT STDMETHODCALLTYPE UIDelegate::webViewSetCursor(
  532. /* [in] */ IWebView *sender,
  533. /* [in] */ OLE_HANDLE cursor)
  534. {
  535. return E_NOTIMPL;
  536. }
  537. HRESULT STDMETHODCALLTYPE UIDelegate::webViewDidInvalidate(
  538. /* [in] */ IWebView *sender)
  539. {
  540. return E_NOTIMPL;
  541. }
  542. HRESULT STDMETHODCALLTYPE UIDelegate::setStatusText(IWebView*, BSTR text)
  543. {
  544. if (gTestRunner->dumpStatusCallbacks())
  545. printf("UI DELEGATE STATUS CALLBACK: setStatusText:%s\n", text ? toUTF8(text).c_str() : "");
  546. return S_OK;
  547. }
  548. HRESULT STDMETHODCALLTYPE UIDelegate::desktopNotificationsDelegate(IWebDesktopNotificationsDelegate** result)
  549. {
  550. m_desktopNotifications.copyRefTo(result);
  551. return S_OK;
  552. }
  553. HRESULT STDMETHODCALLTYPE UIDelegate::createWebViewWithRequest(IWebView* sender, IWebURLRequest* request, IPropertyBag* windowFeatures, IWebView** newWebView)
  554. {
  555. return E_NOTIMPL;
  556. }
  557. HRESULT STDMETHODCALLTYPE UIDelegate::drawBackground(IWebView* sender, OLE_HANDLE hdc, const RECT* dirtyRect)
  558. {
  559. return E_NOTIMPL;
  560. }
  561. HRESULT STDMETHODCALLTYPE UIDelegate::decidePolicyForGeolocationRequest(IWebView* sender, IWebFrame* frame, IWebSecurityOrigin* origin, IWebGeolocationPolicyListener* listener)
  562. {
  563. return E_NOTIMPL;
  564. }
  565. HRESULT STDMETHODCALLTYPE UIDelegate::didPressMissingPluginButton(IDOMElement* element)
  566. {
  567. printf("MISSING PLUGIN BUTTON PRESSED\n");
  568. return S_OK;
  569. }