WinLauncher.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /*
  2. * Copyright (C) 2006 Apple Computer, 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. #pragma once
  26. #include "resource.h"
  27. #include <WebKit/WebKit.h>
  28. class WinLauncherWebHost : public IWebFrameLoadDelegate
  29. {
  30. public:
  31. WinLauncherWebHost() : m_refCount(1) {}
  32. // IUnknown
  33. virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
  34. virtual ULONG STDMETHODCALLTYPE AddRef(void);
  35. virtual ULONG STDMETHODCALLTYPE Release(void);
  36. // IWebFrameLoadDelegate
  37. virtual HRESULT STDMETHODCALLTYPE didStartProvisionalLoadForFrame(
  38. /* [in] */ IWebView* webView,
  39. /* [in] */ IWebFrame* /*frame*/) { return S_OK; }
  40. virtual HRESULT STDMETHODCALLTYPE didReceiveServerRedirectForProvisionalLoadForFrame(
  41. /* [in] */ IWebView *webView,
  42. /* [in] */ IWebFrame *frame) { return S_OK; }
  43. virtual HRESULT STDMETHODCALLTYPE didFailProvisionalLoadWithError(
  44. /* [in] */ IWebView *webView,
  45. /* [in] */ IWebError *error,
  46. /* [in] */ IWebFrame*);
  47. virtual HRESULT STDMETHODCALLTYPE didCommitLoadForFrame(
  48. /* [in] */ IWebView *webView,
  49. /* [in] */ IWebFrame *frame) { return updateAddressBar(webView); }
  50. virtual HRESULT STDMETHODCALLTYPE didReceiveTitle(
  51. /* [in] */ IWebView *webView,
  52. /* [in] */ BSTR title,
  53. /* [in] */ IWebFrame *frame) { return S_OK; }
  54. virtual HRESULT STDMETHODCALLTYPE didChangeIcons(
  55. /* [in] */ IWebView *webView,
  56. /* [in] */ IWebFrame *frame) { return S_OK; }
  57. virtual HRESULT STDMETHODCALLTYPE didReceiveIcon(
  58. /* [in] */ IWebView *webView,
  59. /* [in] */ OLE_HANDLE hBitmap,
  60. /* [in] */ IWebFrame *frame) { return S_OK; }
  61. virtual HRESULT STDMETHODCALLTYPE didFinishLoadForFrame(
  62. /* [in] */ IWebView* webView,
  63. /* [in] */ IWebFrame* /*frame*/);
  64. virtual HRESULT STDMETHODCALLTYPE didFailLoadWithError(
  65. /* [in] */ IWebView *webView,
  66. /* [in] */ IWebError *error,
  67. /* [in] */ IWebFrame *forFrame) { return S_OK; }
  68. virtual HRESULT STDMETHODCALLTYPE didChangeLocationWithinPageForFrame(
  69. /* [in] */ IWebView *webView,
  70. /* [in] */ IWebFrame *frame) { return S_OK; }
  71. virtual HRESULT STDMETHODCALLTYPE willPerformClientRedirectToURL(
  72. /* [in] */ IWebView *webView,
  73. /* [in] */ BSTR url,
  74. /* [in] */ double delaySeconds,
  75. /* [in] */ DATE fireDate,
  76. /* [in] */ IWebFrame *frame) { return S_OK; }
  77. virtual HRESULT STDMETHODCALLTYPE didCancelClientRedirectForFrame(
  78. /* [in] */ IWebView *webView,
  79. /* [in] */ IWebFrame *frame) { return S_OK; }
  80. virtual HRESULT STDMETHODCALLTYPE willCloseFrame(
  81. /* [in] */ IWebView *webView,
  82. /* [in] */ IWebFrame *frame) { return S_OK; }
  83. virtual /* [local] */ HRESULT STDMETHODCALLTYPE windowScriptObjectAvailable(
  84. /* [in] */ IWebView *webView,
  85. /* [in] */ JSContextRef context,
  86. /* [in] */ JSObjectRef windowScriptObject) { return S_OK; }
  87. virtual /* [local] */ HRESULT STDMETHODCALLTYPE didClearWindowObject(
  88. /* [in] */ IWebView *webView,
  89. /* [in] */ JSContextRef context,
  90. /* [in] */ JSObjectRef windowScriptObject,
  91. /* [in] */ IWebFrame *frame) { return S_OK; }
  92. // WinLauncherWebHost
  93. protected:
  94. HRESULT updateAddressBar(IWebView* webView);
  95. protected:
  96. ULONG m_refCount;
  97. };