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#ifndef WebLoaderClient_h
27#define WebLoaderClient_h
28
29#include "APIClient.h"
30#include "SameDocumentNavigationType.h"
31#include "WKPage.h"
32#include <wtf/Forward.h>
33#include <wtf/RefPtr.h>
34#include <wtf/Vector.h>
35
36namespace WebCore {
37class ResourceError;
38}
39
40namespace WebKit {
41
42class APIObject;
43class AuthenticationChallengeProxy;
44class AuthenticationDecisionListener;
45class WebBackForwardListItem;
46class WebFrameProxy;
47class WebPageProxy;
48class WebProtectionSpace;
49
50class WebLoaderClient : public APIClient<WKPageLoaderClient> {
51public:
52    void didStartProvisionalLoadForFrame(WebPageProxy*, WebFrameProxy*, APIObject*);
53    void didReceiveServerRedirectForProvisionalLoadForFrame(WebPageProxy*, WebFrameProxy*, APIObject*);
54    void didFailProvisionalLoadWithErrorForFrame(WebPageProxy*, WebFrameProxy*, const WebCore::ResourceError&, APIObject*);
55    void didCommitLoadForFrame(WebPageProxy*, WebFrameProxy*, APIObject*);
56    void didFinishDocumentLoadForFrame(WebPageProxy*, WebFrameProxy*, APIObject*);
57    void didFinishLoadForFrame(WebPageProxy*, WebFrameProxy*, APIObject*);
58    void didFailLoadWithErrorForFrame(WebPageProxy*, WebFrameProxy*, const WebCore::ResourceError&, APIObject*);
59    void didSameDocumentNavigationForFrame(WebPageProxy*, WebFrameProxy*, SameDocumentNavigationType, APIObject*);
60    void didReceiveTitleForFrame(WebPageProxy*, const String&, WebFrameProxy*, APIObject*);
61    void didFirstLayoutForFrame(WebPageProxy*, WebFrameProxy*, APIObject*);
62    void didFirstVisuallyNonEmptyLayoutForFrame(WebPageProxy*, WebFrameProxy*, APIObject*);
63    void didRemoveFrameFromHierarchy(WebPageProxy*, WebFrameProxy*, APIObject*);
64    void didDisplayInsecureContentForFrame(WebPageProxy*, WebFrameProxy*, APIObject*);
65    void didRunInsecureContentForFrame(WebPageProxy*, WebFrameProxy*, APIObject*);
66
67    bool canAuthenticateAgainstProtectionSpaceInFrame(WebPageProxy*, WebFrameProxy*, WebProtectionSpace*);
68    void didReceiveAuthenticationChallengeInFrame(WebPageProxy*, WebFrameProxy*, AuthenticationChallengeProxy*);
69
70    void didStartProgress(WebPageProxy*);
71    void didChangeProgress(WebPageProxy*);
72    void didFinishProgress(WebPageProxy*);
73
74    // FIXME: These three functions should not be part of this client.
75    void processDidBecomeUnresponsive(WebPageProxy*);
76    void processDidBecomeResponsive(WebPageProxy*);
77    void processDidCrash(WebPageProxy*);
78
79    void didChangeBackForwardList(WebPageProxy*, WebBackForwardListItem* addedItem, Vector<RefPtr<APIObject> >* removedItems);
80    bool shouldGoToBackForwardListItem(WebPageProxy*, WebBackForwardListItem*);
81};
82
83} // namespace WebKit
84
85#endif // WebLoaderClient_h
86