FrameLoadDelegate.h revision f05b935882198ccf7d81675736e3aeb089c5113a
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 FrameLoadDelegate_h
30#define FrameLoadDelegate_h
31
32#include <WebKit/WebKit.h>
33#include <wtf/OwnPtr.h>
34
35class AccessibilityController;
36class GCController;
37
38class FrameLoadDelegate : public IWebFrameLoadDelegate, public IWebFrameLoadDelegatePrivate2 {
39public:
40    FrameLoadDelegate();
41    virtual ~FrameLoadDelegate();
42
43    void processWork();
44
45    void resetToConsistentState();
46
47    AccessibilityController* accessibilityController() const { return m_accessibilityController.get(); }
48
49    // IUnknown
50    virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
51    virtual ULONG STDMETHODCALLTYPE AddRef(void);
52    virtual ULONG STDMETHODCALLTYPE Release(void);
53
54    // IWebFrameLoadDelegate
55    virtual HRESULT STDMETHODCALLTYPE didStartProvisionalLoadForFrame(
56        /* [in] */ IWebView *webView,
57        /* [in] */ IWebFrame *frame);
58
59    virtual HRESULT STDMETHODCALLTYPE didReceiveServerRedirectForProvisionalLoadForFrame(
60        /* [in] */ IWebView *webView,
61        /* [in] */ IWebFrame *frame);
62
63    virtual HRESULT STDMETHODCALLTYPE didFailProvisionalLoadWithError(
64        /* [in] */ IWebView *webView,
65        /* [in] */ IWebError *error,
66        /* [in] */ IWebFrame *frame);
67
68    virtual HRESULT STDMETHODCALLTYPE didCommitLoadForFrame(
69        /* [in] */ IWebView *webView,
70        /* [in] */ IWebFrame *frame);
71
72    virtual HRESULT STDMETHODCALLTYPE didReceiveTitle(
73        /* [in] */ IWebView *webView,
74        /* [in] */ BSTR title,
75        /* [in] */ IWebFrame *frame);
76
77    virtual HRESULT STDMETHODCALLTYPE didChangeIcons(
78        /* [in] */ IWebView *webView,
79        /* [in] */ IWebFrame *frame);
80
81    virtual HRESULT STDMETHODCALLTYPE didReceiveIcon(
82        /* [in] */ IWebView *webView,
83        /* [in] */ OLE_HANDLE image,
84        /* [in] */ IWebFrame *frame) { return E_NOTIMPL; }
85
86    virtual HRESULT STDMETHODCALLTYPE didFinishLoadForFrame(
87        /* [in] */ IWebView *webView,
88        /* [in] */ IWebFrame *frame);
89
90    virtual HRESULT STDMETHODCALLTYPE didFailLoadWithError(
91        /* [in] */ IWebView *webView,
92        /* [in] */ IWebError *error,
93        /* [in] */ IWebFrame *forFrame);
94
95    virtual HRESULT STDMETHODCALLTYPE didChangeLocationWithinPageForFrame(
96        /* [in] */ IWebView *webView,
97        /* [in] */ IWebFrame *frame) { return E_NOTIMPL; }
98
99    virtual HRESULT STDMETHODCALLTYPE willPerformClientRedirectToURL(
100        /* [in] */ IWebView *webView,
101        /* [in] */ BSTR url,
102        /* [in] */ double delaySeconds,
103        /* [in] */ DATE fireDate,
104        /* [in] */ IWebFrame *frame);
105
106    virtual HRESULT STDMETHODCALLTYPE didCancelClientRedirectForFrame(
107        /* [in] */ IWebView *webView,
108        /* [in] */ IWebFrame *frame);
109
110    virtual HRESULT STDMETHODCALLTYPE willCloseFrame(
111        /* [in] */ IWebView *webView,
112        /* [in] */ IWebFrame *frame);
113
114    virtual HRESULT STDMETHODCALLTYPE windowScriptObjectAvailable(
115        /* [in] */ IWebView *sender,
116        /* [in] */ JSContextRef context,
117        /* [in] */ JSObjectRef windowObject) { return E_NOTIMPL; }
118
119    virtual /* [local] */ HRESULT STDMETHODCALLTYPE didClearWindowObject(
120        /* [in] */ IWebView* webView,
121        /* [in] */ JSContextRef context,
122        /* [in] */ JSObjectRef windowObject,
123        /* [in] */ IWebFrame* frame);
124
125    // IWebFrameLoadDelegatePrivate
126    virtual HRESULT STDMETHODCALLTYPE didFinishDocumentLoadForFrame(
127        /* [in] */ IWebView *sender,
128        /* [in] */ IWebFrame *frame);
129
130    virtual HRESULT STDMETHODCALLTYPE didFirstLayoutInFrame(
131        /* [in] */ IWebView *sender,
132        /* [in] */ IWebFrame *frame) { return E_NOTIMPL; }
133
134    virtual HRESULT STDMETHODCALLTYPE didHandleOnloadEventsForFrame(
135        /* [in] */ IWebView *sender,
136        /* [in] */ IWebFrame *frame);
137
138    virtual HRESULT STDMETHODCALLTYPE didFirstVisuallyNonEmptyLayoutInFrame(
139        /* [in] */ IWebView *sender,
140        /* [in] */ IWebFrame *frame);
141
142    // IWebFrameLoadDelegatePrivate2
143    virtual HRESULT STDMETHODCALLTYPE didDisplayInsecureContent(
144        /* [in] */ IWebView *sender);
145
146    virtual HRESULT STDMETHODCALLTYPE didRunInsecureContent(
147        /* [in] */ IWebView *sender,
148        /* [in] */ IWebSecurityOrigin *origin);
149
150    virtual HRESULT STDMETHODCALLTYPE didClearWindowObjectForFrameInScriptWorld(IWebView*, IWebFrame*, IWebScriptWorld*);
151
152    virtual HRESULT STDMETHODCALLTYPE didPushStateWithinPageForFrame(
153        /* [in] */ IWebView *sender,
154        /* [in] */ IWebFrame *frame) { return E_NOTIMPL; }
155
156    virtual HRESULT STDMETHODCALLTYPE didReplaceStateWithinPageForFrame(
157        /* [in] */ IWebView *sender,
158        /* [in] */ IWebFrame *frame) { return E_NOTIMPL; }
159
160    virtual HRESULT STDMETHODCALLTYPE didPopStateWithinPageForFrame(
161        /* [in] */ IWebView *sender,
162        /* [in] */ IWebFrame *frame) { return E_NOTIMPL; }
163
164private:
165    void didClearWindowObjectForFrameInIsolatedWorld(IWebFrame*, IWebScriptWorld*);
166    void didClearWindowObjectForFrameInStandardWorld(IWebFrame*);
167
168    void locationChangeDone(IWebError*, IWebFrame*);
169
170    ULONG m_refCount;
171    OwnPtr<GCController> m_gcController;
172    OwnPtr<AccessibilityController> m_accessibilityController;
173};
174
175#endif // FrameLoadDelegate_h
176