Merge "Use EwkView's variables instead of drawingScaleFactor and drawingScrollPositio...
[framework/web/webkit-efl.git] / Source / WebKit2 / UIProcess / WebFrameProxy.h
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 WebFrameProxy_h
27 #define WebFrameProxy_h
28
29 #include "APIObject.h"
30 #include "ImmutableArray.h"
31 #include "GenericCallback.h"
32 #include "WebFrameListenerProxy.h"
33 #include <WebCore/FrameLoaderTypes.h>
34 #include <wtf/Forward.h>
35 #include <wtf/PassRefPtr.h>
36 #include <wtf/text/WTFString.h>
37
38 #if ENABLE(TIZEN_ON_AUTHENTICATION_REQUESTED)
39 #include "AuthenticationChallengeProxy.h"
40 #endif
41
42 namespace CoreIPC {
43     class ArgumentDecoder;
44     class Connection;
45     class MessageID;
46 }
47
48 namespace WebKit {
49
50 class ImmutableArray;
51 class PlatformCertificateInfo;
52 class WebCertificateInfo;
53 class WebFormSubmissionListenerProxy;
54 class WebFramePolicyListenerProxy;
55 class WebPageProxy;
56
57 #if ENABLE(TIZEN_ON_AUTHENTICATION_REQUESTED)
58 class WebProcessProxy;
59 #endif
60
61 typedef GenericCallback<WKDataRef> DataCallback;
62
63 class WebFrameProxy : public APIObject {
64 public:
65     static const Type APIType = TypeFrame;
66
67     static PassRefPtr<WebFrameProxy> create(WebPageProxy* page, uint64_t frameID)
68     {
69         return adoptRef(new WebFrameProxy(page, frameID));
70     }
71
72     virtual ~WebFrameProxy();
73
74     enum LoadState {
75         LoadStateProvisional,
76         LoadStateCommitted,
77         LoadStateFinished
78     };
79
80     uint64_t frameID() const { return m_frameID; }
81     WebPageProxy* page() const { return m_page; }
82
83     WebFrameProxy* parentFrame() { return m_parentFrame; }
84     WebFrameProxy* nextSibling() { return m_nextSibling; }
85     WebFrameProxy* previousSibling() { return m_previousSibling; }
86     WebFrameProxy* firstChild() { return m_firstChild; }
87     WebFrameProxy* lastChild() { return m_lastChild; }
88
89     void disconnect();
90
91     bool isMainFrame() const;
92
93     void setIsFrameSet(bool value) { m_isFrameSet = value; }
94     bool isFrameSet() const { return m_isFrameSet; }
95
96     LoadState loadState() const { return m_loadState; }
97     
98     void stopLoading() const;
99
100     const String& url() const { return m_url; }
101     const String& provisionalURL() const { return m_provisionalURL; }
102
103     void setUnreachableURL(const String&);
104     const String& unreachableURL() const { return m_unreachableURL; }
105
106     const String& mimeType() const { return m_MIMEType; }
107
108     const String& title() const { return m_title; }
109
110     WebCertificateInfo* certificateInfo() const { return m_certificateInfo.get(); }
111
112     bool canProvideSource() const;
113     bool canShowMIMEType(const String& mimeType) const;
114
115     bool isDisplayingStandaloneImageDocument() const;
116     bool isDisplayingMarkupDocument() const;
117     bool isDisplayingPDFDocument() const;
118
119     void getWebArchive(PassRefPtr<DataCallback>);
120     void getMainResourceData(PassRefPtr<DataCallback>);
121     void getResourceData(WebURL*, PassRefPtr<DataCallback>);
122
123     void didStartProvisionalLoad(const String& url);
124     void didReceiveServerRedirectForProvisionalLoad(const String& url);
125     void didFailProvisionalLoad();
126     void didCommitLoad(const String& contentType, const PlatformCertificateInfo&);
127     void didFinishLoad();
128     void didFailLoad();
129     void didSameDocumentNavigation(const String&); // eg. anchor navigation, session state change.
130     void didChangeTitle(const String&);
131
132     // Frame tree operations.
133     void appendChild(WebFrameProxy*);
134     void removeChild(WebFrameProxy*);
135     void didRemoveFromHierarchy();
136     PassRefPtr<ImmutableArray> childFrames();
137     bool isDescendantOf(const WebFrameProxy* ancestor) const;
138     void dumpFrameTreeToSTDOUT(unsigned indent = 0);
139
140     // Policy operations.
141     void receivedPolicyDecision(WebCore::PolicyAction, uint64_t listenerID);
142     WebFramePolicyListenerProxy* setUpPolicyListenerProxy(uint64_t listenerID);
143     WebFormSubmissionListenerProxy* setUpFormSubmissionListenerProxy(uint64_t listenerID);
144 #if ENABLE(TIZEN_ON_AUTHENTICATION_REQUESTED)
145     AuthenticationChallengeProxy* setUpAuthenticationChallengeProxy(const WebCore::AuthenticationChallenge& authenticationChallenge, uint64_t challengeID, WebProcessProxy* process);
146 #endif
147
148 private:
149     WebFrameProxy(WebPageProxy* page, uint64_t frameID);
150
151     virtual Type type() const { return APIType; }
152
153     WebPageProxy* m_page;
154     WebFrameProxy* m_parentFrame;
155     WebFrameProxy* m_nextSibling;
156     WebFrameProxy* m_previousSibling;
157     WebFrameProxy* m_firstChild;
158     WebFrameProxy* m_lastChild;
159
160     LoadState m_loadState;
161     String m_url;
162     String m_provisionalURL;
163     String m_unreachableURL;
164     String m_lastUnreachableURL;
165     String m_MIMEType;
166     String m_title;
167     bool m_isFrameSet;
168     RefPtr<WebCertificateInfo> m_certificateInfo;
169     RefPtr<WebFrameListenerProxy> m_activeListener;
170     uint64_t m_frameID;
171 #if ENABLE(TIZEN_ON_AUTHENTICATION_REQUESTED)
172     RefPtr<AuthenticationChallengeProxy> m_activeAuthenticationChallenge;
173 #endif
174 };
175
176 } // namespace WebKit
177
178 #endif // WebFrameProxy_h