15267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)/*
25267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
35267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) *
45267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * Redistribution and use in source and binary forms, with or without
55267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * modification, are permitted provided that the following conditions are
65267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * met:
75267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) *
85267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) *     * Redistributions of source code must retain the above copyright
95267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * notice, this list of conditions and the following disclaimer.
105267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) *     * Redistributions in binary form must reproduce the above
115267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * copyright notice, this list of conditions and the following disclaimer
125267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * in the documentation and/or other materials provided with the
135267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * distribution.
145267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) *     * Neither the name of Google Inc. nor the names of its
155267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * contributors may be used to endorse or promote products derived from
165267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * this software without specific prior written permission.
175267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) *
185267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
195267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
205267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
215267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
225267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
235267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
245267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
255267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
265267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
275267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
285267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
295267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) */
305267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
315267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#ifndef WebFrameClient_h
325267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#define WebFrameClient_h
335267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
346f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch#include "../platform/WebColor.h"
357242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci#include "WebAXObject.h"
365267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#include "WebDOMMessageEvent.h"
37e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles)#include "WebDataSource.h"
3807a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch#include "WebFrame.h"
39a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch#include "WebHistoryCommitType.h"
40aafa69cb17c9d6606c07663ade5f81388a2c5986Ben Murdoch#include "WebHistoryItem.h"
415267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#include "WebIconURL.h"
425267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#include "WebNavigationPolicy.h"
435267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#include "WebNavigationType.h"
445267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#include "WebSecurityOrigin.h"
455267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#include "WebTextDirection.h"
4651b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)#include "public/platform/WebCommon.h"
4751b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)#include "public/platform/WebFileSystem.h"
4851b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)#include "public/platform/WebFileSystemType.h"
4909380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)#include "public/platform/WebStorageQuotaCallbacks.h"
5051b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)#include "public/platform/WebStorageQuotaType.h"
5151b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)#include "public/platform/WebURLError.h"
5251b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)#include "public/platform/WebURLRequest.h"
535267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#include <v8.h>
545267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
5551b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)namespace blink {
565267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
575267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebApplicationCacheHost;
585267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebApplicationCacheHostClient;
595267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebCachedURLRequest;
606f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdochclass WebColorChooser;
616f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdochclass WebColorChooserClient;
6207a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdochclass WebContentDecryptionModule;
635267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebCookieJar;
645267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebDataSource;
655267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebDOMEvent;
669e12abdf8c3a23d52091ea54ebb6a04d327f9300Torne (Richard Coles)class WebExternalPopupMenu;
679e12abdf8c3a23d52091ea54ebb6a04d327f9300Torne (Richard Coles)class WebExternalPopupMenuClient;
685267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebFormElement;
69f6b7aed3f7ce69aca0d7a032d144cbd088b04393Torne (Richard Coles)class WebGeolocationClient;
7009380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)class WebInputEvent;
715267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebMediaPlayer;
725267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebMediaPlayerClient;
735d92fedcae5e801a8b224de090094f2d9df0b54aTorne (Richard Coles)class WebMIDIClient;
74197021e6b966cfb06891637935ef33fff06433d1Ben Murdochclass WebNotificationPermissionCallback;
756f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdochclass WebNotificationPresenter;
761e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)class WebServiceWorkerProvider;
771e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)class WebServiceWorkerProviderClient;
78f6b7aed3f7ce69aca0d7a032d144cbd088b04393Torne (Richard Coles)class WebSocketHandle;
795267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebNode;
805267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebPlugin;
815267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebRTCPeerConnectionHandler;
825d92fedcae5e801a8b224de090094f2d9df0b54aTorne (Richard Coles)class WebScreenOrientationClient;
835267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebSharedWorker;
845267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebSharedWorkerClient;
855267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebSocketStreamHandle;
865267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebString;
875267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebURL;
885267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebURLLoader;
895267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebURLResponse;
90f91f5fa1608c2cdd9af1842fb5dadbe78275be2aBo Liuclass WebUserMediaClient;
9119cde67944066db31e633d9e386f2aa9bf9fadb3Torne (Richard Coles)class WebWorkerPermissionClientProxy;
926f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdochstruct WebColorSuggestion;
93aafa69cb17c9d6606c07663ade5f81388a2c5986Ben Murdochstruct WebConsoleMessage;
94d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)struct WebContextMenuData;
955267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)struct WebPluginParams;
969e12abdf8c3a23d52091ea54ebb6a04d327f9300Torne (Richard Coles)struct WebPopupMenuInfo;
975267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)struct WebRect;
985267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)struct WebSize;
995267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)struct WebURLError;
1005267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1015267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebFrameClient {
1025267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)public:
1035267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Factory methods -----------------------------------------------------
1045267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1055267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // May return null.
10607a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual WebPlugin* createPlugin(WebLocalFrame*, const WebPluginParams&) { return 0; }
1075267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1085267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // May return null.
1097242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci    // WebContentDecryptionModule* may be null if one has not yet been set.
1107242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci    virtual WebMediaPlayer* createMediaPlayer(WebLocalFrame*, const WebURL&, WebMediaPlayerClient*, WebContentDecryptionModule*) { return 0; }
1115267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1125267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // May return null.
11307a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual WebContentDecryptionModule* createContentDecryptionModule(WebLocalFrame*, const WebSecurityOrigin&, const WebString& keySystem) { return 0; }
11407a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch
11507a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    // May return null.
11607a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual WebApplicationCacheHost* createApplicationCacheHost(WebLocalFrame*, WebApplicationCacheHostClient*) { return 0; }
1175267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
118f91f5fa1608c2cdd9af1842fb5dadbe78275be2aBo Liu    // May return null.
119f91f5fa1608c2cdd9af1842fb5dadbe78275be2aBo Liu    virtual WebServiceWorkerProvider* createServiceWorkerProvider(WebLocalFrame* frame) { return 0; }
1209bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles)
12119cde67944066db31e633d9e386f2aa9bf9fadb3Torne (Richard Coles)    // May return null.
12207a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual WebWorkerPermissionClientProxy* createWorkerPermissionClientProxy(WebLocalFrame*) { return 0; }
12319cde67944066db31e633d9e386f2aa9bf9fadb3Torne (Richard Coles)
1249e12abdf8c3a23d52091ea54ebb6a04d327f9300Torne (Richard Coles)    // Create a new WebPopupMenu. In the "createExternalPopupMenu" form, the
1259e12abdf8c3a23d52091ea54ebb6a04d327f9300Torne (Richard Coles)    // client is responsible for rendering the contents of the popup menu.
1269e12abdf8c3a23d52091ea54ebb6a04d327f9300Torne (Richard Coles)    virtual WebExternalPopupMenu* createExternalPopupMenu(
1279e12abdf8c3a23d52091ea54ebb6a04d327f9300Torne (Richard Coles)        const WebPopupMenuInfo&, WebExternalPopupMenuClient*) { return 0; }
1289e12abdf8c3a23d52091ea54ebb6a04d327f9300Torne (Richard Coles)
1295267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1305267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Services ------------------------------------------------------------
1315267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1325267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // A frame specific cookie jar.  May return null, in which case
1335267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // WebKitPlatformSupport::cookieJar() will be called to access cookies.
13407a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual WebCookieJar* cookieJar(WebLocalFrame*) { return 0; }
1355267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1365267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1375267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // General notifications -----------------------------------------------
1385267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
139a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch    // Indicates if creating a plugin without an associated renderer is supported.
140a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch    virtual bool canCreatePluginWithoutRenderer(const WebString& mimeType) { return false; }
141a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch
1425267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Indicates that another page has accessed the DOM of the initial empty
1435267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // document of a main frame. After this, it is no longer safe to show a
1445267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // pending navigation's URL, because a URL spoof is possible.
14507a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual void didAccessInitialDocument(WebLocalFrame*) { }
1465267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1475267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // A child frame was created in this frame. This is called when the frame
1481e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    // is created and initialized. Takes the name of the new frame, the parent
1491e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    // frame and returns a new WebFrame. The WebFrame is considered in-use
1501e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    // until frameDetached() is called on it.
15109380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    // Note: If you override this, you should almost certainly be overriding
15209380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    // frameDetached().
15307a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual WebFrame* createChildFrame(WebLocalFrame* parent, const WebString& frameName) { return 0; }
1545267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1555267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // This frame set its opener to null, disowning it.
1565267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // See http://html.spec.whatwg.org/#dom-opener.
15707a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual void didDisownOpener(WebLocalFrame*) { }
1585267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1595267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // This frame has been detached from the view, but has not been closed yet.
1605267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void frameDetached(WebFrame*) { }
1615267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
162d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)    // This frame has become focused..
163d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)    virtual void frameFocused() { }
164d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)
1655267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // This frame is about to be closed. This is called after frameDetached,
1665267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // when the document is being unloaded, due to new one committing.
167a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch    virtual void willClose(WebFrame*) { }
1685267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1695267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // This frame's name has changed.
17007a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual void didChangeName(WebLocalFrame*, const WebString&) { }
1715267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1721e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    // Called when a watched CSS selector matches or stops matching.
17307a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual void didMatchCSS(WebLocalFrame*, const WebVector<WebString>& newlyMatchingSelectors, const WebVector<WebString>& stoppedMatchingSelectors) { }
1741e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)
1756f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch
176aafa69cb17c9d6606c07663ade5f81388a2c5986Ben Murdoch    // Console messages ----------------------------------------------------
177aafa69cb17c9d6606c07663ade5f81388a2c5986Ben Murdoch
178aafa69cb17c9d6606c07663ade5f81388a2c5986Ben Murdoch    // Whether or not we should report a detailed message for the given source.
179aafa69cb17c9d6606c07663ade5f81388a2c5986Ben Murdoch    virtual bool shouldReportDetailedMessageForSource(const WebString& source) { return false; }
180aafa69cb17c9d6606c07663ade5f81388a2c5986Ben Murdoch
181aafa69cb17c9d6606c07663ade5f81388a2c5986Ben Murdoch    // A new message was added to the console.
182aafa69cb17c9d6606c07663ade5f81388a2c5986Ben Murdoch    virtual void didAddMessageToConsole(const WebConsoleMessage&, const WebString& sourceName, unsigned sourceLine, const WebString& stackTrace) { }
183aafa69cb17c9d6606c07663ade5f81388a2c5986Ben Murdoch
1846f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch
1855267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Load commands -------------------------------------------------------
1865267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1875267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // The client should handle the navigation externally.
1885267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void loadURLExternally(
18907a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch        WebLocalFrame*, const WebURLRequest&, WebNavigationPolicy, const WebString& downloadName) { }
1905267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1915267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1925267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Navigational queries ------------------------------------------------
1935267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1945267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // The client may choose to alter the navigation policy.  Otherwise,
1955267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // defaultPolicy should just be returned.
196197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch
197197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch    struct NavigationPolicyInfo {
198197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch        WebLocalFrame* frame;
199197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch        WebDataSource::ExtraData* extraData;
200197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch        const WebURLRequest& urlRequest;
201197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch        WebNavigationType navigationType;
202197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch        WebNavigationPolicy defaultPolicy;
203197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch        bool isRedirect;
204197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch        bool isTransitionNavigation;
205197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch
206197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch        NavigationPolicyInfo(const WebURLRequest& urlRequest)
207197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch            : frame(0)
208197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch            , extraData(0)
209197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch            , urlRequest(urlRequest)
210197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch            , navigationType(WebNavigationTypeOther)
211197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch            , defaultPolicy(WebNavigationPolicyIgnore)
212197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch            , isRedirect(false)
213197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch            , isTransitionNavigation(false) { }
214197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch    };
215197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch
216197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch    virtual WebNavigationPolicy decidePolicyForNavigation(const NavigationPolicyInfo& info)
217197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch    {
218197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch        return decidePolicyForNavigation(info.frame, info.extraData, info.urlRequest, info.navigationType, info.defaultPolicy, info.isRedirect);
219197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch    }
220197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch
221197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch    // DEPRECATED
2225267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual WebNavigationPolicy decidePolicyForNavigation(
22307a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch        WebLocalFrame*, WebDataSource::ExtraData*, const WebURLRequest&, WebNavigationType,
2245267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        WebNavigationPolicy defaultPolicy, bool isRedirect) { return defaultPolicy; }
2255267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
226aafa69cb17c9d6606c07663ade5f81388a2c5986Ben Murdoch    // During a history navigation, we may choose to load new subframes from history as well.
227aafa69cb17c9d6606c07663ade5f81388a2c5986Ben Murdoch    // This returns such a history item if appropriate.
228aafa69cb17c9d6606c07663ade5f81388a2c5986Ben Murdoch    virtual WebHistoryItem historyItemForNewChildFrame(WebFrame*) { return WebHistoryItem(); }
229aafa69cb17c9d6606c07663ade5f81388a2c5986Ben Murdoch
2305267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2315267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Navigational notifications ------------------------------------------
2325267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
23307a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    // These notifications bracket any loading that occurs in the WebFrame.
23407a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual void didStartLoading(bool toDifferentDocument) { }
23507a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual void didStopLoading() { }
23607a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch
23707a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    // Notification that some progress was made loading the current frame.
23807a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    // loadProgress is a value between 0 (nothing loaded) and 1.0 (frame fully
23907a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    // loaded).
24007a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual void didChangeLoadProgress(double loadProgress) { }
24107a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch
2425267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // A form submission has been requested, but the page's submit event handler
2435267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // hasn't yet had a chance to run (and possibly alter/interrupt the submit.)
24407a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual void willSendSubmitEvent(WebLocalFrame*, const WebFormElement&) { }
2455267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2465267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // A form submission is about to occur.
24707a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual void willSubmitForm(WebLocalFrame*, const WebFormElement&) { }
2485267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2495267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // A datasource has been created for a new navigation.  The given
2505267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // datasource will become the provisional datasource for the frame.
25107a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual void didCreateDataSource(WebLocalFrame*, WebDataSource*) { }
2525267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2535267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // A new provisional load has been started.
254e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)    virtual void didStartProvisionalLoad(WebLocalFrame* localFrame, bool isTransitionNavigation) { }
2555267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2565267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // The provisional load was redirected via a HTTP 3xx response.
25707a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual void didReceiveServerRedirectForProvisionalLoad(WebLocalFrame*) { }
2585267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2595267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // The provisional load failed.
26007a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual void didFailProvisionalLoad(WebLocalFrame*, const WebURLError&) { }
2615267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2625267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // The provisional datasource is now committed.  The first part of the
2635267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // response body has been received, and the encoding of the response
2645267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // body is known.
265a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch    virtual void didCommitProvisionalLoad(WebLocalFrame*, const WebHistoryItem&, WebHistoryCommitType) { }
2665267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2675267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // The window object for the frame has been cleared of any extra
2685267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // properties that may have been set by script from the previously
2695267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // loaded document.
270d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)    virtual void didClearWindowObject(WebLocalFrame* frame) { }
2715267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2725267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // The document element has been created.
27307a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual void didCreateDocumentElement(WebLocalFrame*) { }
2745267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2755267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // The page title is available.
27607a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual void didReceiveTitle(WebLocalFrame* frame, const WebString& title, WebTextDirection direction) { }
2775267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2785267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // The icon for the page have changed.
27907a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual void didChangeIcon(WebLocalFrame*, WebIconURL::Type) { }
2805267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2815267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // The frame's document finished loading.
28207a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual void didFinishDocumentLoad(WebLocalFrame*) { }
2835267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2845267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // The 'load' event was dispatched.
28507a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual void didHandleOnloadEvents(WebLocalFrame*) { }
2865267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2875267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // The frame's document or one of its subresources failed to load.
28807a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual void didFailLoad(WebLocalFrame*, const WebURLError&) { }
2895267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2905267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // The frame's document and all of its subresources succeeded to load.
29107a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual void didFinishLoad(WebLocalFrame*) { }
2925267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2935267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // The navigation resulted in no change to the documents within the page.
2945267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // For example, the navigation may have just resulted in scrolling to a
2955267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // named anchor or a PopState event may have been dispatched.
296a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch    virtual void didNavigateWithinPage(WebLocalFrame*, const WebHistoryItem&, WebHistoryCommitType) { }
2975267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2985267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Called upon update to scroll position, document state, and other
2995267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // non-navigational events related to the data held by WebHistoryItem.
3005267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // WARNING: This method may be called very frequently.
30107a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual void didUpdateCurrentHistoryItem(WebLocalFrame*) { }
3025267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
303323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles)    // The frame's manifest has changed.
304323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles)    virtual void didChangeManifest(WebLocalFrame*) { }
305323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles)
306197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch    // The frame's theme color has changed.
307197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch    virtual void didChangeThemeColor() { }
308197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch
309197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch
310197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch    // Transition navigations -----------------------------------------------
3115d92fedcae5e801a8b224de090094f2d9df0b54aTorne (Richard Coles)
312197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch    // Provides serialized markup of transition elements for use in the following navigation.
313197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch    virtual void addNavigationTransitionData(const WebString& allowedDestinationOrigin, const WebString& selector, const WebString& markup) { }
314323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles)
315197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch
316197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch    // Web Notifications ---------------------------------------------------
317197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch
318197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch    // Requests permission to display platform notifications on the origin of this frame.
319197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch    virtual void requestNotificationPermission(const WebSecurityOrigin&, WebNotificationPermissionCallback* callback) { }
3206f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch
3216f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch    // Called to retrieve the provider of desktop notifications.
322197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch    // FIXME: Remove this method once the presenter is obtained through Platform.
3236f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch    virtual WebNotificationPresenter* notificationPresenter() { return 0; }
3246f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch
3256f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch
32643e7502580f146aa5b3db8267ba6dbb5c733a489Torne (Richard Coles)    // Editing -------------------------------------------------------------
32743e7502580f146aa5b3db8267ba6dbb5c733a489Torne (Richard Coles)
32843e7502580f146aa5b3db8267ba6dbb5c733a489Torne (Richard Coles)    // These methods allow the client to intercept and overrule editing
32943e7502580f146aa5b3db8267ba6dbb5c733a489Torne (Richard Coles)    // operations.
33043e7502580f146aa5b3db8267ba6dbb5c733a489Torne (Richard Coles)    virtual void didChangeSelection(bool isSelectionEmpty) { }
33143e7502580f146aa5b3db8267ba6dbb5c733a489Torne (Richard Coles)
3325267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3336f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch    // Dialogs -------------------------------------------------------------
3346f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch
3356f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch    // This method opens the color chooser and returns a new WebColorChooser
3366f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch    // instance. If there is a WebColorChooser already from the last time this
3376f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch    // was called, it ends the color chooser by calling endChooser, and replaces
3386f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch    // it with the new one. The given list of suggestions can be used to show a
3396f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch    // simple interface with a limited set of choices.
3406f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch
3416f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch    virtual WebColorChooser* createColorChooser(
3426f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch        WebColorChooserClient*,
3436f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch        const WebColor&,
3446f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch        const WebVector<WebColorSuggestion>&) { return 0; }
3456f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch
3466f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch    // Displays a modal alert dialog containing the given message. Returns
3476f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch    // once the user dismisses the dialog.
3486f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch    virtual void runModalAlertDialog(const WebString& message) { }
3496f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch
3506f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch    // Displays a modal confirmation dialog with the given message as
3516f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch    // description and OK/Cancel choices. Returns true if the user selects
3526f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch    // 'OK' or false otherwise.
3536f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch    virtual bool runModalConfirmDialog(const WebString& message) { return false; }
3546f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch
3556f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch    // Displays a modal input dialog with the given message as description
3566f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch    // and OK/Cancel choices. The input field is pre-filled with
3576f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch    // defaultValue. Returns true if the user selects 'OK' or false
3586f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch    // otherwise. Upon returning true, actualValue contains the value of
3596f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch    // the input field.
3606f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch    virtual bool runModalPromptDialog(
3616f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch        const WebString& message, const WebString& defaultValue,
3626f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch        WebString* actualValue) { return false; }
3636f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch
3646f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch    // Displays a modal confirmation dialog containing the given message as
3656f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch    // description and OK/Cancel choices, where 'OK' means that it is okay
3666f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch    // to proceed with closing the view. Returns true if the user selects
3676f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch    // 'OK' or false otherwise.
3686f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch    virtual bool runModalBeforeUnloadDialog(
3696f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch        bool isReload, const WebString& message) { return true; }
3706f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch
3716f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch
372d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)    // UI ------------------------------------------------------------------
373d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)
374d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)    // Shows a context menu with commands relevant to a specific element on
375d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)    // the given frame. Additional context data is supplied.
376d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)    virtual void showContextMenu(const WebContextMenuData&) { }
377d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)
378d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)    // Called when the data attached to the currently displayed context menu is
379d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)    // invalidated. The context menu may be closed if possible.
380d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)    virtual void clearContextMenu() { }
381d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)
382d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)
3835267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Low-level resource notifications ------------------------------------
3845267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3855267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // An element will request a resource.
38607a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual void willRequestResource(WebLocalFrame*, const WebCachedURLRequest&) { }
3875267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3885267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // A request is about to be sent out, and the client may modify it.  Request
3895267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // is writable, and changes to the URL, for example, will change the request
3905267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // made.  If this request is the result of a redirect, then redirectResponse
3915267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // will be non-null and contain the response that triggered the redirect.
3925267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void willSendRequest(
39307a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch        WebLocalFrame*, unsigned identifier, WebURLRequest&,
3945267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        const WebURLResponse& redirectResponse) { }
3955267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3965267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Response headers have been received for the resource request given
3975267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // by identifier.
3985267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void didReceiveResponse(
39907a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch        WebLocalFrame*, unsigned identifier, const WebURLResponse&) { }
40007a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch
40107a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual void didChangeResourcePriority(
402e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)        WebLocalFrame* webFrame, unsigned identifier, const WebURLRequest::Priority& priority, int) { }
4035267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4045267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // The resource request given by identifier succeeded.
4055267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void didFinishResourceLoad(
40607a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch        WebLocalFrame*, unsigned identifier) { }
4075267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4085267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // The specified request was satified from WebCore's memory cache.
4095267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void didLoadResourceFromMemoryCache(
41007a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch        WebLocalFrame*, const WebURLRequest&, const WebURLResponse&) { }
4115267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4125267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // This frame has displayed inactive content (such as an image) from an
4135267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // insecure source.  Inactive content cannot spread to other frames.
41407a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual void didDisplayInsecureContent(WebLocalFrame*) { }
4155267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4165267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // The indicated security origin has run active content (such as a
4175267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // script) from an insecure source.  Note that the insecure content can
4185267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // spread to other frames in the same origin.
41907a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual void didRunInsecureContent(WebLocalFrame*, const WebSecurityOrigin&, const WebURL& insecureURL) { }
4205267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4215267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // A reflected XSS was encountered in the page and suppressed.
42207a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual void didDetectXSS(WebLocalFrame*, const WebURL&, bool didBlockEntirePage) { }
4235267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4241fad5ca6c42d689812b66fc493992aa6d747a6fbBen Murdoch    // A PingLoader was created, and a request dispatched to a URL.
42507a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual void didDispatchPingLoader(WebLocalFrame*, const WebURL&) { }
4261fad5ca6c42d689812b66fc493992aa6d747a6fbBen Murdoch
42706f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)    // The loaders in this frame have been stopped.
42807a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual void didAbortLoading(WebLocalFrame*) { }
42906f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)
4306f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch
4315267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Script notifications ------------------------------------------------
4325267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4335267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Notifies that a new script context has been created for this frame.
4345267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // This is similar to didClearWindowObject but only called once per
4355267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // frame context.
43607a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual void didCreateScriptContext(WebLocalFrame*, v8::Handle<v8::Context>, int extensionGroup, int worldId) { }
4375267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4385267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // WebKit is about to release its reference to a v8 context for a frame.
43907a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual void willReleaseScriptContext(WebLocalFrame*, v8::Handle<v8::Context>, int worldId) { }
4405267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4416f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch
4425267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Geometry notifications ----------------------------------------------
4435267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4445267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // The frame's document finished the initial non-empty layout of a page.
44507a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual void didFirstVisuallyNonEmptyLayout(WebLocalFrame*) { }
4465267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4475267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // The main frame scrolled.
44807a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual void didChangeScrollOffset(WebLocalFrame*) { }
4495267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4505267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // If the frame is loading an HTML document, this will be called to
4515267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // notify that the <body> will be attached soon.
45207a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual void willInsertBody(WebLocalFrame*) { }
4535267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4546f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch
4555267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Find-in-page notifications ------------------------------------------
4565267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4575267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Notifies how many matches have been found so far, for a given
4585267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // identifier.  |finalUpdate| specifies whether this is the last update
4595267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // (all frames have completed scoping).
4605267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void reportFindInPageMatchCount(
4615267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        int identifier, int count, bool finalUpdate) { }
4625267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4635267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Notifies what tick-mark rect is currently selected.   The given
4645267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // identifier lets the client know which request this message belongs
4655267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // to, so that it can choose to ignore the message if it has moved on
4665267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // to other things.  The selection rect is expected to have coordinates
4675267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // relative to the top left corner of the web page area and represent
4685267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // where on the screen the selection rect is currently located.
4695267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void reportFindInPageSelection(
4705267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        int identifier, int activeMatchOrdinal, const WebRect& selection) { }
4715267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4726f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch
4735267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Quota ---------------------------------------------------------
4745267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4755267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Requests a new quota size for the origin's storage.
4765267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // |newQuotaInBytes| indicates how much storage space (in bytes) the
4775267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // caller expects to need.
4785267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // WebStorageQuotaCallbacks::didGrantStorageQuota will be called when
4795267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // a new quota is granted. WebStorageQuotaCallbacks::didFail
4805267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // is called with an error code otherwise.
4815267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Note that the requesting quota size may not always be granted and
4825267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // a smaller amount of quota than requested might be returned.
4835267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void requestStorageQuota(
48407a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch        WebLocalFrame*, WebStorageQuotaType,
4855267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        unsigned long long newQuotaInBytes,
48609380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)        WebStorageQuotaCallbacks) { }
4875267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4885267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // WebSocket -----------------------------------------------------
4895267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
490f6b7aed3f7ce69aca0d7a032d144cbd088b04393Torne (Richard Coles)    // A WebSocket object is going to open a new socket stream connection. Used
491f6b7aed3f7ce69aca0d7a032d144cbd088b04393Torne (Richard Coles)    // by the old WebSocket implementation.
4925267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void willOpenSocketStream(WebSocketStreamHandle*) { }
4935267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
494f6b7aed3f7ce69aca0d7a032d144cbd088b04393Torne (Richard Coles)    // A WebSocket object is going to open a new WebSocket connection. Used by
495f6b7aed3f7ce69aca0d7a032d144cbd088b04393Torne (Richard Coles)    // the new WebSocket implementation.
496f6b7aed3f7ce69aca0d7a032d144cbd088b04393Torne (Richard Coles)    virtual void willOpenWebSocket(WebSocketHandle*) { }
497f6b7aed3f7ce69aca0d7a032d144cbd088b04393Torne (Richard Coles)
498f6b7aed3f7ce69aca0d7a032d144cbd088b04393Torne (Richard Coles)
499f6b7aed3f7ce69aca0d7a032d144cbd088b04393Torne (Richard Coles)    // Geolocation ---------------------------------------------------------
500f6b7aed3f7ce69aca0d7a032d144cbd088b04393Torne (Richard Coles)
501f6b7aed3f7ce69aca0d7a032d144cbd088b04393Torne (Richard Coles)    // Access the embedder API for (client-based) geolocation client .
502f6b7aed3f7ce69aca0d7a032d144cbd088b04393Torne (Richard Coles)    virtual WebGeolocationClient* geolocationClient() { return 0; }
503f6b7aed3f7ce69aca0d7a032d144cbd088b04393Torne (Richard Coles)
5046f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch
5055267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // MediaStream -----------------------------------------------------
5065267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
5075267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // A new WebRTCPeerConnectionHandler is created.
50807a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual void willStartUsingPeerConnectionHandler(WebLocalFrame*, WebRTCPeerConnectionHandler*) { }
5095267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
510f91f5fa1608c2cdd9af1842fb5dadbe78275be2aBo Liu    virtual WebUserMediaClient* userMediaClient() { return 0; }
511f91f5fa1608c2cdd9af1842fb5dadbe78275be2aBo Liu
5126f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch
5135d92fedcae5e801a8b224de090094f2d9df0b54aTorne (Richard Coles)    // Web MIDI -------------------------------------------------------------
5145d92fedcae5e801a8b224de090094f2d9df0b54aTorne (Richard Coles)
5155d92fedcae5e801a8b224de090094f2d9df0b54aTorne (Richard Coles)    virtual WebMIDIClient* webMIDIClient() { return 0; }
5165d92fedcae5e801a8b224de090094f2d9df0b54aTorne (Richard Coles)
5175d92fedcae5e801a8b224de090094f2d9df0b54aTorne (Richard Coles)
5185267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Messages ------------------------------------------------------
5195267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
5205267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Notifies the embedder that a postMessage was issued on this frame, and
5215267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // gives the embedder a chance to handle it instead of WebKit. Returns true
5225267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // if the embedder handled it.
5235267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool willCheckAndDispatchMessageEvent(
52407a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch        WebLocalFrame* sourceFrame,
5255267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        WebFrame* targetFrame,
5265267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        WebSecurityOrigin target,
5275267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        WebDOMMessageEvent event) { return false; }
5285267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
5295267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Asks the embedder if a specific user agent should be used for the given
5305267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // URL. Non-empty strings indicate an override should be used. Otherwise,
5315267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Platform::current()->userAgent() will be called to provide one.
53207a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual WebString userAgentOverride(WebLocalFrame*, const WebURL& url) { return WebString(); }
5335267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
5345267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Asks the embedder what value the network stack will send for the DNT
5355267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // header. An empty string indicates that no DNT header will be send.
53607a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual WebString doNotTrackValue(WebLocalFrame*) { return WebString(); }
5375267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
5386f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch
5395267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // WebGL ------------------------------------------------------
5405267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
5415267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Asks the embedder whether WebGL is allowed for the given WebFrame.
5425267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // This call is placed here instead of WebPermissionClient because this
5435267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // class is implemented in content/, and putting it here avoids adding
5445267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // more public content/ APIs.
54507a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual bool allowWebGL(WebLocalFrame*, bool defaultValue) { return defaultValue; }
5465267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
5475267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Notifies the client that a WebGL context was lost on this page with the
5485267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // given reason (one of the GL_ARB_robustness status codes; see
5495267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Extensions3D.h in WebCore/platform/graphics).
55007a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual void didLoseWebGLContext(WebLocalFrame*, int) { }
5515267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
55209380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    // FIXME: Remove this method once we have input routing in the browser
55309380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    // process. See http://crbug.com/339659.
55409380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    virtual void forwardInputEvent(const WebInputEvent*) { }
55509380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)
55609380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    // Send initial drawing parameters to a child frame that is being rendered out of process.
55709380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    virtual void initializeChildFrame(const WebRect& frameRect, float scaleFactor) { }
55809380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)
5595d92fedcae5e801a8b224de090094f2d9df0b54aTorne (Richard Coles)
5605d92fedcae5e801a8b224de090094f2d9df0b54aTorne (Richard Coles)    // Screen Orientation --------------------------------------------------
5615d92fedcae5e801a8b224de090094f2d9df0b54aTorne (Richard Coles)
5625d92fedcae5e801a8b224de090094f2d9df0b54aTorne (Richard Coles)    // Access the embedder API for (client-based) screen orientation client .
5635d92fedcae5e801a8b224de090094f2d9df0b54aTorne (Richard Coles)    virtual WebScreenOrientationClient* webScreenOrientationClient() { return 0; }
5645d92fedcae5e801a8b224de090094f2d9df0b54aTorne (Richard Coles)
5657242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci    // Accessibility -------------------------------------------------------
5667242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci
5677242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci    // Notifies embedder about an accessibility event.
5687242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci    virtual void postAccessibilityEvent(const WebAXObject&, WebAXEvent) { }
5697242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci
5707242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci    // ServiceWorker -------------------------------------------------------
5717242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci
5727242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci    // Whether the frame is controlled by the ServiceWorker
5737242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci    virtual bool isControlledByServiceWorker() { return false; }
5747242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci
5755267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)protected:
5765d92fedcae5e801a8b224de090094f2d9df0b54aTorne (Richard Coles)    virtual ~WebFrameClient() { }
5775267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)};
5785267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
57951b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)} // namespace blink
5805267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
5815267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#endif
582