Upstream version 5.34.92.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / web / FrameLoaderClientImpl.h
1 /*
2  * Copyright (C) 2009, 2012 Google Inc. All rights reserved.
3  * Copyright (C) 2011 Apple Inc. All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met:
8  *
9  *     * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *     * Redistributions in binary form must reproduce the above
12  * copyright notice, this list of conditions and the following disclaimer
13  * in the documentation and/or other materials provided with the
14  * distribution.
15  *     * Neither the name of Google Inc. nor the names of its
16  * contributors may be used to endorse or promote products derived from
17  * this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  */
31
32 #ifndef FrameLoaderClientImpl_h
33 #define FrameLoaderClientImpl_h
34
35 #include "core/loader/FrameLoaderClient.h"
36 #include "platform/weborigin/KURL.h"
37 #include "wtf/PassOwnPtr.h"
38 #include "wtf/RefPtr.h"
39
40 namespace blink {
41
42 class WebFrameImpl;
43 class WebPluginContainerImpl;
44 class WebPluginLoadObserver;
45
46 class FrameLoaderClientImpl FINAL : public WebCore::FrameLoaderClient {
47 public:
48     FrameLoaderClientImpl(WebFrameImpl* webFrame);
49     virtual ~FrameLoaderClientImpl();
50
51     WebFrameImpl* webFrame() const { return m_webFrame; }
52
53     // WebCore::FrameLoaderClient ----------------------------------------------
54
55     // Notifies the WebView delegate that the JS window object has been cleared,
56     // giving it a chance to bind native objects to the window before script
57     // parsing begins.
58     virtual void dispatchDidClearWindowObjectInWorld(WebCore::DOMWrapperWorld*) OVERRIDE;
59     virtual void documentElementAvailable() OVERRIDE;
60
61     // Script in the page tried to allocate too much memory.
62     virtual void didExhaustMemoryAvailableForScript();
63
64     virtual void didCreateScriptContext(v8::Handle<v8::Context>, int extensionGroup, int worldId) OVERRIDE;
65     virtual void willReleaseScriptContext(v8::Handle<v8::Context>, int worldId) OVERRIDE;
66
67     // Returns true if we should allow the given V8 extension to be added to
68     // the script context at the currently loading page and given extension group.
69     virtual bool allowScriptExtension(const String& extensionName, int extensionGroup, int worldId) OVERRIDE;
70
71     virtual bool hasWebView() const OVERRIDE;
72     virtual void detachedFromParent() OVERRIDE;
73     virtual void dispatchWillRequestAfterPreconnect(WebCore::ResourceRequest&) OVERRIDE;
74     virtual void dispatchWillSendRequest(WebCore::DocumentLoader*, unsigned long identifier, WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse) OVERRIDE;
75     virtual void dispatchDidReceiveResponse(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceResponse&) OVERRIDE;
76     virtual void dispatchDidChangeResourcePriority(unsigned long identifier, WebCore::ResourceLoadPriority) OVERRIDE;
77     virtual void dispatchDidFinishLoading(WebCore::DocumentLoader*, unsigned long identifier) OVERRIDE;
78     virtual void dispatchDidLoadResourceFromMemoryCache(const WebCore::ResourceRequest&, const WebCore::ResourceResponse&) OVERRIDE;
79     virtual void dispatchDidHandleOnloadEvents() OVERRIDE;
80     virtual void dispatchDidReceiveServerRedirectForProvisionalLoad() OVERRIDE;
81     virtual void dispatchDidNavigateWithinPage(WebCore::HistoryItem*, WebCore::HistoryCommitType) OVERRIDE;
82     virtual void dispatchWillClose() OVERRIDE;
83     virtual void dispatchDidStartProvisionalLoad() OVERRIDE;
84     virtual void dispatchDidReceiveTitle(const String&) OVERRIDE;
85     virtual void dispatchDidChangeIcons(WebCore::IconType) OVERRIDE;
86     virtual void dispatchDidCommitLoad(WebCore::Frame*, WebCore::HistoryItem*, WebCore::HistoryCommitType) OVERRIDE;
87     virtual void dispatchDidFailProvisionalLoad(const WebCore::ResourceError&) OVERRIDE;
88     virtual void dispatchDidFailLoad(const WebCore::ResourceError&) OVERRIDE;
89     virtual void dispatchDidFinishDocumentLoad() OVERRIDE;
90     virtual void dispatchDidFinishLoad() OVERRIDE;
91     virtual void dispatchDidFirstVisuallyNonEmptyLayout() OVERRIDE;
92     virtual WebCore::NavigationPolicy decidePolicyForNavigation(const WebCore::ResourceRequest&, WebCore::DocumentLoader*, WebCore::NavigationPolicy) OVERRIDE;
93     virtual void dispatchWillRequestResource(WebCore::FetchRequest*) OVERRIDE;
94     virtual void dispatchWillSendSubmitEvent(PassRefPtr<WebCore::FormState>) OVERRIDE;
95     virtual void dispatchWillSubmitForm(PassRefPtr<WebCore::FormState>) OVERRIDE;
96     virtual void postProgressStartedNotification(WebCore::LoadStartType) OVERRIDE;
97     virtual void postProgressEstimateChangedNotification() OVERRIDE;
98     virtual void postProgressFinishedNotification() OVERRIDE;
99     virtual void loadURLExternally(const WebCore::ResourceRequest&, WebCore::NavigationPolicy, const String& suggestedName = String()) OVERRIDE;
100     virtual bool navigateBackForward(int offset) const OVERRIDE;
101     virtual void didAccessInitialDocument() OVERRIDE;
102     virtual void didDisownOpener() OVERRIDE;
103     virtual void didDisplayInsecureContent() OVERRIDE;
104     virtual void didRunInsecureContent(WebCore::SecurityOrigin*, const WebCore::KURL& insecureURL) OVERRIDE;
105     virtual void didDetectXSS(const WebCore::KURL&, bool didBlockEntirePage) OVERRIDE;
106     virtual void didDispatchPingLoader(const WebCore::KURL&) OVERRIDE;
107     virtual void selectorMatchChanged(const Vector<String>& addedSelectors, const Vector<String>& removedSelectors) OVERRIDE;
108     virtual PassRefPtr<WebCore::DocumentLoader> createDocumentLoader(WebCore::Frame*, const WebCore::ResourceRequest&, const WebCore::SubstituteData&) OVERRIDE;
109     virtual WTF::String userAgent(const WebCore::KURL&) OVERRIDE;
110     virtual WTF::String doNotTrackValue() OVERRIDE;
111     virtual void transitionToCommittedForNewPage() OVERRIDE;
112     virtual PassRefPtr<WebCore::Frame> createFrame(const WebCore::KURL&, const WTF::AtomicString& name, const WTF::String& referrer, WebCore::HTMLFrameOwnerElement*) OVERRIDE;
113     virtual PassRefPtr<WebCore::Widget> createPlugin(
114         const WebCore::IntSize&, WebCore::HTMLPlugInElement*, const WebCore::KURL&,
115         const Vector<WTF::String>&, const Vector<WTF::String>&,
116         const WTF::String&, bool loadManually) OVERRIDE;
117     virtual PassRefPtr<WebCore::Widget> createJavaAppletWidget(
118         const WebCore::IntSize&,
119         WebCore::HTMLAppletElement*,
120         const WebCore::KURL& /* base_url */,
121         const Vector<WTF::String>& paramNames,
122         const Vector<WTF::String>& paramValues) OVERRIDE;
123     virtual WebCore::ObjectContentType objectContentType(
124         const WebCore::KURL&, const WTF::String& mimeType, bool shouldPreferPlugInsForImages) OVERRIDE;
125     virtual void didChangeScrollOffset() OVERRIDE;
126     virtual bool allowScript(bool enabledPerSettings) OVERRIDE;
127     virtual bool allowScriptFromSource(bool enabledPerSettings, const WebCore::KURL& scriptURL) OVERRIDE;
128     virtual bool allowPlugins(bool enabledPerSettings) OVERRIDE;
129     virtual bool allowImage(bool enabledPerSettings, const WebCore::KURL& imageURL) OVERRIDE;
130     virtual bool allowDisplayingInsecureContent(bool enabledPerSettings, WebCore::SecurityOrigin*, const WebCore::KURL&) OVERRIDE;
131     virtual bool allowRunningInsecureContent(bool enabledPerSettings, WebCore::SecurityOrigin*, const WebCore::KURL&) OVERRIDE;
132     virtual void didNotAllowScript() OVERRIDE;
133     virtual void didNotAllowPlugins() OVERRIDE;
134
135     virtual WebCookieJar* cookieJar() const OVERRIDE;
136     virtual bool willCheckAndDispatchMessageEvent(WebCore::SecurityOrigin* target, WebCore::MessageEvent*) const OVERRIDE;
137     virtual void didChangeName(const String&) OVERRIDE;
138
139     virtual void dispatchWillOpenSocketStream(WebCore::SocketStreamHandle*) OVERRIDE;
140
141     virtual void dispatchWillStartUsingPeerConnectionHandler(blink::WebRTCPeerConnectionHandler*) OVERRIDE;
142
143     virtual void didRequestAutocomplete(PassRefPtr<WebCore::FormState>) OVERRIDE;
144
145     virtual bool allowWebGL(bool enabledPerSettings) OVERRIDE;
146     virtual void didLoseWebGLContext(int arbRobustnessContextLostReason) OVERRIDE;
147     virtual bool allowWebGLDebugRendererInfo() OVERRIDE;
148
149     virtual void dispatchWillInsertBody() OVERRIDE;
150
151     virtual PassOwnPtr<WebServiceWorkerProvider> createServiceWorkerProvider(PassOwnPtr<WebServiceWorkerProviderClient>) OVERRIDE;
152     virtual WebCore::SharedWorkerRepositoryClient* sharedWorkerRepositoryClient() OVERRIDE;
153
154     virtual void didStopAllLoaders() OVERRIDE;
155
156 private:
157     virtual bool isFrameLoaderClientImpl() const OVERRIDE { return true; }
158
159     PassOwnPtr<WebPluginLoadObserver> pluginLoadObserver(WebCore::DocumentLoader*);
160
161     // The WebFrame that owns this object and manages its lifetime. Therefore,
162     // the web frame object is guaranteed to exist.
163     WebFrameImpl* m_webFrame;
164 };
165
166 DEFINE_TYPE_CASTS(FrameLoaderClientImpl, WebCore::FrameLoaderClient, client, client->isFrameLoaderClientImpl(), client.isFrameLoaderClientImpl());
167
168 } // namespace blink
169
170 #endif