• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
35 class AccessibilityController;
36 class GCController;
37 
38 class FrameLoadDelegate : public IWebFrameLoadDelegate, public IWebFrameLoadDelegatePrivate2 {
39 public:
40     FrameLoadDelegate();
41     virtual ~FrameLoadDelegate();
42 
43     void processWork();
44 
45     void resetToConsistentState();
46 
accessibilityController()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 
didReceiveIcon(IWebView * webView,OLE_HANDLE image,IWebFrame * frame)77     virtual HRESULT STDMETHODCALLTYPE didReceiveIcon(
78         /* [in] */ IWebView *webView,
79         /* [in] */ OLE_HANDLE image,
80         /* [in] */ IWebFrame *frame) { return E_NOTIMPL; }
81 
82     virtual HRESULT STDMETHODCALLTYPE didFinishLoadForFrame(
83         /* [in] */ IWebView *webView,
84         /* [in] */ IWebFrame *frame);
85 
86     virtual HRESULT STDMETHODCALLTYPE didFailLoadWithError(
87         /* [in] */ IWebView *webView,
88         /* [in] */ IWebError *error,
89         /* [in] */ IWebFrame *forFrame);
90 
didChangeLocationWithinPageForFrame(IWebView * webView,IWebFrame * frame)91     virtual HRESULT STDMETHODCALLTYPE didChangeLocationWithinPageForFrame(
92         /* [in] */ IWebView *webView,
93         /* [in] */ IWebFrame *frame) { return E_NOTIMPL; }
94 
95     virtual HRESULT STDMETHODCALLTYPE willPerformClientRedirectToURL(
96         /* [in] */ IWebView *webView,
97         /* [in] */ BSTR url,
98         /* [in] */ double delaySeconds,
99         /* [in] */ DATE fireDate,
100         /* [in] */ IWebFrame *frame);
101 
102     virtual HRESULT STDMETHODCALLTYPE didCancelClientRedirectForFrame(
103         /* [in] */ IWebView *webView,
104         /* [in] */ IWebFrame *frame);
105 
106     virtual HRESULT STDMETHODCALLTYPE willCloseFrame(
107         /* [in] */ IWebView *webView,
108         /* [in] */ IWebFrame *frame);
109 
windowScriptObjectAvailable(IWebView * sender,JSContextRef context,JSObjectRef windowObject)110     virtual HRESULT STDMETHODCALLTYPE windowScriptObjectAvailable(
111         /* [in] */ IWebView *sender,
112         /* [in] */ JSContextRef context,
113         /* [in] */ JSObjectRef windowObject) { return E_NOTIMPL; }
114 
115     virtual /* [local] */ HRESULT STDMETHODCALLTYPE didClearWindowObject(
116         /* [in] */ IWebView* webView,
117         /* [in] */ JSContextRef context,
118         /* [in] */ JSObjectRef windowObject,
119         /* [in] */ IWebFrame* frame);
120 
121     // IWebFrameLoadDelegatePrivate
122     virtual HRESULT STDMETHODCALLTYPE didFinishDocumentLoadForFrame(
123         /* [in] */ IWebView *sender,
124         /* [in] */ IWebFrame *frame);
125 
didFirstLayoutInFrame(IWebView * sender,IWebFrame * frame)126     virtual HRESULT STDMETHODCALLTYPE didFirstLayoutInFrame(
127         /* [in] */ IWebView *sender,
128         /* [in] */ IWebFrame *frame) { return E_NOTIMPL; }
129 
130     virtual HRESULT STDMETHODCALLTYPE didHandleOnloadEventsForFrame(
131         /* [in] */ IWebView *sender,
132         /* [in] */ IWebFrame *frame);
133 
134     virtual HRESULT STDMETHODCALLTYPE didFirstVisuallyNonEmptyLayoutInFrame(
135         /* [in] */ IWebView *sender,
136         /* [in] */ IWebFrame *frame);
137 
138     // IWebFrameLoadDelegatePrivate2
139     virtual HRESULT STDMETHODCALLTYPE didDisplayInsecureContent(
140         /* [in] */ IWebView *sender);
141 
142     virtual HRESULT STDMETHODCALLTYPE didRunInsecureContent(
143         /* [in] */ IWebView *sender,
144         /* [in] */ IWebSecurityOrigin *origin);
145 
146     virtual HRESULT STDMETHODCALLTYPE didClearWindowObjectForFrameInScriptWorld(IWebView*, IWebFrame*, IWebScriptWorld*);
147 
didPushStateWithinPageForFrame(IWebView * sender,IWebFrame * frame)148     virtual HRESULT STDMETHODCALLTYPE didPushStateWithinPageForFrame(
149         /* [in] */ IWebView *sender,
150         /* [in] */ IWebFrame *frame) { return E_NOTIMPL; }
151 
didReplaceStateWithinPageForFrame(IWebView * sender,IWebFrame * frame)152     virtual HRESULT STDMETHODCALLTYPE didReplaceStateWithinPageForFrame(
153         /* [in] */ IWebView *sender,
154         /* [in] */ IWebFrame *frame) { return E_NOTIMPL; }
155 
didPopStateWithinPageForFrame(IWebView * sender,IWebFrame * frame)156     virtual HRESULT STDMETHODCALLTYPE didPopStateWithinPageForFrame(
157         /* [in] */ IWebView *sender,
158         /* [in] */ IWebFrame *frame) { return E_NOTIMPL; }
159 
160 private:
161     void didClearWindowObjectForFrameInIsolatedWorld(IWebFrame*, IWebScriptWorld*);
162     void didClearWindowObjectForFrameInStandardWorld(IWebFrame*);
163 
164     void locationChangeDone(IWebError*, IWebFrame*);
165 
166     ULONG m_refCount;
167     OwnPtr<GCController> m_gcController;
168     OwnPtr<AccessibilityController> m_accessibilityController;
169 };
170 
171 #endif // FrameLoadDelegate_h
172