WebLoaderClient.cpp revision 65f03d4f644ce73618e5f4f50dd694b26f55ae12
1/*
2 * Copyright (C) 2010 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 * 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 INC. AND ITS CONTRIBUTORS ``AS IS''
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#include "WebLoaderClient.h"
27
28#include "WKAPICast.h"
29#include <string.h>
30
31using namespace WebCore;
32
33namespace WebKit {
34
35void WebLoaderClient::didStartProvisionalLoadForFrame(WebPageProxy* page, WebFrameProxy* frame, APIObject* userData)
36{
37    if (!m_client.didStartProvisionalLoadForFrame)
38        return;
39
40    m_client.didStartProvisionalLoadForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo);
41}
42
43void WebLoaderClient::didReceiveServerRedirectForProvisionalLoadForFrame(WebPageProxy* page, WebFrameProxy* frame, APIObject* userData)
44{
45    if (!m_client.didReceiveServerRedirectForProvisionalLoadForFrame)
46        return;
47
48    m_client.didReceiveServerRedirectForProvisionalLoadForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo);
49}
50
51void WebLoaderClient::didFailProvisionalLoadWithErrorForFrame(WebPageProxy* page, WebFrameProxy* frame, const ResourceError& error, APIObject* userData)
52{
53    if (!m_client.didFailProvisionalLoadWithErrorForFrame)
54        return;
55
56    m_client.didFailProvisionalLoadWithErrorForFrame(toAPI(page), toAPI(frame), toAPI(error), toAPI(userData), m_client.clientInfo);
57}
58
59void WebLoaderClient::didCommitLoadForFrame(WebPageProxy* page, WebFrameProxy* frame, APIObject* userData)
60{
61    if (!m_client.didCommitLoadForFrame)
62        return;
63
64    m_client.didCommitLoadForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo);
65}
66
67void WebLoaderClient::didFinishDocumentLoadForFrame(WebPageProxy* page, WebFrameProxy* frame, APIObject* userData)
68{
69    if (!m_client.didFinishDocumentLoadForFrame)
70        return;
71
72    m_client.didFinishDocumentLoadForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo);
73}
74
75void WebLoaderClient::didFinishLoadForFrame(WebPageProxy* page, WebFrameProxy* frame, APIObject* userData)
76{
77    if (!m_client.didFinishLoadForFrame)
78        return;
79
80    m_client.didFinishLoadForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo);
81}
82
83void WebLoaderClient::didFailLoadWithErrorForFrame(WebPageProxy* page, WebFrameProxy* frame, const ResourceError& error, APIObject* userData)
84{
85    if (!m_client.didFailLoadWithErrorForFrame)
86        return;
87
88    m_client.didFailLoadWithErrorForFrame(toAPI(page), toAPI(frame), toAPI(error), toAPI(userData), m_client.clientInfo);
89}
90
91void WebLoaderClient::didSameDocumentNavigationForFrame(WebPageProxy* page, WebFrameProxy* frame, SameDocumentNavigationType type, APIObject* userData)
92{
93    if (!m_client.didSameDocumentNavigationForFrame)
94        return;
95
96    m_client.didSameDocumentNavigationForFrame(toAPI(page), toAPI(frame), toAPI(type), toAPI(userData), m_client.clientInfo);
97}
98
99void WebLoaderClient::didReceiveTitleForFrame(WebPageProxy* page, const String& title, WebFrameProxy* frame, APIObject* userData)
100{
101    if (!m_client.didReceiveTitleForFrame)
102        return;
103
104    m_client.didReceiveTitleForFrame(toAPI(page), toAPI(title.impl()), toAPI(frame), toAPI(userData), m_client.clientInfo);
105}
106
107void WebLoaderClient::didFirstLayoutForFrame(WebPageProxy* page, WebFrameProxy* frame, APIObject* userData)
108{
109    if (!m_client.didFirstLayoutForFrame)
110        return;
111
112    m_client.didFirstLayoutForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo);
113}
114
115void WebLoaderClient::didFirstVisuallyNonEmptyLayoutForFrame(WebPageProxy* page, WebFrameProxy* frame, APIObject* userData)
116{
117    if (!m_client.didFirstVisuallyNonEmptyLayoutForFrame)
118        return;
119
120    m_client.didFirstVisuallyNonEmptyLayoutForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo);
121}
122
123void WebLoaderClient::didRemoveFrameFromHierarchy(WebPageProxy* page, WebFrameProxy* frame, APIObject* userData)
124{
125    if (!m_client.didRemoveFrameFromHierarchy)
126        return;
127
128    m_client.didRemoveFrameFromHierarchy(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo);
129}
130
131void WebLoaderClient::didDisplayInsecureContentForFrame(WebPageProxy* page, WebFrameProxy* frame, APIObject* userData)
132{
133    if (!m_client.didDisplayInsecureContentForFrame)
134        return;
135
136    m_client.didDisplayInsecureContentForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo);
137}
138
139void WebLoaderClient::didRunInsecureContentForFrame(WebPageProxy* page, WebFrameProxy* frame, APIObject* userData)
140{
141    if (!m_client.didRunInsecureContentForFrame)
142        return;
143
144    m_client.didRunInsecureContentForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo);
145}
146
147bool WebLoaderClient::canAuthenticateAgainstProtectionSpaceInFrame(WebPageProxy* page, WebFrameProxy* frame, WebProtectionSpace* protectionSpace)
148{
149    if (!m_client.canAuthenticateAgainstProtectionSpaceInFrame)
150        return false;
151
152    return m_client.canAuthenticateAgainstProtectionSpaceInFrame(toAPI(page), toAPI(frame), toAPI(protectionSpace), m_client.clientInfo);
153}
154
155void WebLoaderClient::didReceiveAuthenticationChallengeInFrame(WebPageProxy* page, WebFrameProxy* frame, AuthenticationChallengeProxy* authenticationChallenge)
156{
157    if (!m_client.didReceiveAuthenticationChallengeInFrame)
158        return;
159
160    m_client.didReceiveAuthenticationChallengeInFrame(toAPI(page), toAPI(frame), toAPI(authenticationChallenge), m_client.clientInfo);
161}
162
163void WebLoaderClient::didStartProgress(WebPageProxy* page)
164{
165    if (!m_client.didStartProgress)
166        return;
167
168    m_client.didStartProgress(toAPI(page), m_client.clientInfo);
169}
170
171void WebLoaderClient::didChangeProgress(WebPageProxy* page)
172{
173    if (!m_client.didChangeProgress)
174        return;
175
176    m_client.didChangeProgress(toAPI(page), m_client.clientInfo);
177}
178
179void WebLoaderClient::didFinishProgress(WebPageProxy* page)
180{
181    if (!m_client.didFinishProgress)
182        return;
183
184    m_client.didFinishProgress(toAPI(page), m_client.clientInfo);
185}
186
187void WebLoaderClient::processDidBecomeUnresponsive(WebPageProxy* page)
188{
189    if (!m_client.processDidBecomeUnresponsive)
190        return;
191
192    m_client.processDidBecomeUnresponsive(toAPI(page), m_client.clientInfo);
193}
194
195void WebLoaderClient::processDidBecomeResponsive(WebPageProxy* page)
196{
197    if (!m_client.processDidBecomeResponsive)
198        return;
199
200    m_client.processDidBecomeResponsive(toAPI(page), m_client.clientInfo);
201}
202
203void WebLoaderClient::processDidCrash(WebPageProxy* page)
204{
205    if (!m_client.processDidCrash)
206        return;
207
208    m_client.processDidCrash(toAPI(page), m_client.clientInfo);
209}
210
211void WebLoaderClient::didChangeBackForwardList(WebPageProxy* page)
212{
213    if (!m_client.didChangeBackForwardList)
214        return;
215
216    m_client.didChangeBackForwardList(toAPI(page), m_client.clientInfo);
217}
218
219} // namespace WebKit
220