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