summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/public/web/WebFrameClient.h
blob: 8ac6ce0ffe602fa3cc5abc74901caac399f82eb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
/*
 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 *
 *     * Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above
 * copyright notice, this list of conditions and the following disclaimer
 * in the documentation and/or other materials provided with the
 * distribution.
 *     * Neither the name of Google Inc. nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef WebFrameClient_h
#define WebFrameClient_h

#include "../platform/WebColor.h"
#include "WebAXObject.h"
#include "WebDOMMessageEvent.h"
#include "WebDataSource.h"
#include "WebFrame.h"
#include "WebFrameOwnerProperties.h"
#include "WebHistoryCommitType.h"
#include "WebHistoryItem.h"
#include "WebIconURL.h"
#include "WebNavigationPolicy.h"
#include "WebNavigationType.h"
#include "WebNavigatorContentUtilsClient.h"
#include "WebSandboxFlags.h"
#include "WebTextDirection.h"
#include "public/platform/WebCommon.h"
#include "public/platform/WebFileSystem.h"
#include "public/platform/WebFileSystemType.h"
#include "public/platform/WebSecurityOrigin.h"
#include "public/platform/WebSetSinkIdCallbacks.h"
#include "public/platform/WebStorageQuotaCallbacks.h"
#include "public/platform/WebStorageQuotaType.h"
#include "public/platform/WebURLError.h"
#include "public/platform/WebURLRequest.h"
#include <v8.h>

namespace blink {

enum class WebTreeScopeType;
class WebApplicationCacheHost;
class WebApplicationCacheHostClient;
class WebAppBannerClient;
class WebBluetooth;
class WebColorChooser;
class WebColorChooserClient;
class WebContentDecryptionModule;
class WebCookieJar;
class WebCString;
class WebDataSource;
class WebEncryptedMediaClient;
class WebExternalPopupMenu;
class WebExternalPopupMenuClient;
class WebFormElement;
class WebGeolocationClient;
class WebInstalledAppClient;
class WebMediaPlayer;
class WebMediaPlayerClient;
class WebMediaPlayerEncryptedMediaClient;
class WebMediaSession;
class WebMIDIClient;
class WebNotificationPermissionCallback;
class WebPermissionClient;
class WebServiceWorkerProvider;
class WebSocketHandle;
class WebPlugin;
class WebPresentationClient;
class WebPushClient;
class WebRTCPeerConnectionHandler;
class WebScreenOrientationClient;
class WebString;
class WebURL;
class WebURLResponse;
class WebUSBClient;
class WebUserMediaClient;
class WebVRClient;
class WebWakeLockClient;
class WebWorkerContentSettingsClientProxy;
struct WebColorSuggestion;
struct WebConsoleMessage;
struct WebContextMenuData;
struct WebPluginParams;
struct WebPopupMenuInfo;
struct WebRect;
struct WebURLError;

class WebFrameClient {
public:
    // Factory methods -----------------------------------------------------

    // May return null.
    virtual WebPlugin* createPlugin(WebLocalFrame*, const WebPluginParams&) { return 0; }

    // May return null.
    // WebContentDecryptionModule* may be null if one has not yet been set.
    virtual WebMediaPlayer* createMediaPlayer(const WebURL&, WebMediaPlayerClient*, WebMediaPlayerEncryptedMediaClient*, WebContentDecryptionModule*, const WebString& sinkId, WebMediaSession*) { return 0; }

    // May return null.
    virtual WebMediaSession* createMediaSession() { return 0; }

    // May return null.
    virtual WebApplicationCacheHost* createApplicationCacheHost(WebApplicationCacheHostClient*) { return 0; }

    // May return null.
    virtual WebServiceWorkerProvider* createServiceWorkerProvider() { return 0; }

    // May return null.
    virtual WebWorkerContentSettingsClientProxy* createWorkerContentSettingsClientProxy() { return 0; }

    // Create a new WebPopupMenu. In the "createExternalPopupMenu" form, the
    // client is responsible for rendering the contents of the popup menu.
    virtual WebExternalPopupMenu* createExternalPopupMenu(
        const WebPopupMenuInfo&, WebExternalPopupMenuClient*) { return 0; }


    // Services ------------------------------------------------------------

    // A frame specific cookie jar.  May return null, in which case
    // WebKitPlatformSupport::cookieJar() will be called to access cookies.
    virtual WebCookieJar* cookieJar() { return 0; }


    // General notifications -----------------------------------------------

    // Indicates if creating a plugin without an associated renderer is supported.
    virtual bool canCreatePluginWithoutRenderer(const WebString& mimeType) { return false; }

    // Indicates that another page has accessed the DOM of the initial empty
    // document of a main frame. After this, it is no longer safe to show a
    // pending navigation's URL, because a URL spoof is possible.
    virtual void didAccessInitialDocument() { }

    // A child frame was created in this frame. This is called when the frame
    // is created and initialized. Takes the name of the new frame, the parent
    // frame and returns a new WebFrame. The WebFrame is considered in-use
    // until frameDetached() is called on it.
    // Note: If you override this, you should almost certainly be overriding
    // frameDetached().
    virtual WebFrame* createChildFrame(WebLocalFrame* parent, WebTreeScopeType, const WebString& name, const WebString& uniqueName, WebSandboxFlags sandboxFlags, const WebFrameOwnerProperties&) { return nullptr; }

    // This frame has set its opener to another frame, or disowned the opener
    // if opener is null. See http://html.spec.whatwg.org/#dom-opener.
    virtual void didChangeOpener(WebFrame*) { }

    // Specifies the reason for the detachment.
    enum class DetachType { Remove, Swap };

    // This frame has been detached from the view, but has not been closed yet.
    virtual void frameDetached(WebFrame*, DetachType) { }

    // This frame has become focused..
    virtual void frameFocused() { }

    // This frame is about to be closed. This is called after frameDetached,
    // when the document is being unloaded, due to new one committing.
    virtual void willClose(WebFrame*) { }

    // This frame's name has changed.
    virtual void didChangeName(const WebString& name, const WebString& uniqueName) { }

    // This frame has been set to enforce strict mixed content checking.
    virtual void didEnforceStrictMixedContentChecking() {}

    // This frame has been updated to a unique origin, which should be
    // considered potentially trustworthy if
    // |isPotentiallyTrustworthyUniqueOrigin| is true. TODO(estark):
    // this method only exists to support dynamic sandboxing via a CSP
    // delivered in a <meta> tag. This is not supposed to be allowed per
    // the CSP spec and should be ripped out. https://crbug.com/594645
    virtual void didUpdateToUniqueOrigin(bool isPotentiallyTrustworthyUniqueOrigin) {}

    // The sandbox flags have changed for a child frame of this frame.
    virtual void didChangeSandboxFlags(WebFrame* childFrame, WebSandboxFlags flags) { }

    // Some frame owner properties have changed for a child frame of this frame.
    // Frame owner properties currently include: scrolling, marginwidth and
    // marginheight.
    virtual void didChangeFrameOwnerProperties(WebFrame* childFrame, const WebFrameOwnerProperties&) { }

    // Called when a watched CSS selector matches or stops matching.
    virtual void didMatchCSS(WebLocalFrame*, const WebVector<WebString>& newlyMatchingSelectors, const WebVector<WebString>& stoppedMatchingSelectors) { }


    // Console messages ----------------------------------------------------

    // Whether or not we should report a detailed message for the given source.
    virtual bool shouldReportDetailedMessageForSource(const WebString& source) { return false; }

    // A new message was added to the console.
    virtual void didAddMessageToConsole(const WebConsoleMessage&, const WebString& sourceName, unsigned sourceLine, const WebString& stackTrace) { }


    // Load commands -------------------------------------------------------

    // The client should handle the navigation externally.
    virtual void loadURLExternally(const WebURLRequest&, WebNavigationPolicy, const WebString& downloadName, bool shouldReplaceCurrentEntry) {}

    // Navigational queries ------------------------------------------------

    // The client may choose to alter the navigation policy.  Otherwise,
    // defaultPolicy should just be returned.

    struct NavigationPolicyInfo {
        WebDataSource::ExtraData* extraData;

        // Note: if browser side navigations are enabled, the client may modify
        // the urlRequest. However, should this happen, the client should change
        // the WebNavigationPolicy to WebNavigationPolicyIgnore, and the load
        // should stop in blink. In all other cases, the urlRequest should not
        // be modified.
        WebURLRequest& urlRequest;
        WebNavigationType navigationType;
        WebNavigationPolicy defaultPolicy;
        bool replacesCurrentHistoryItem;
        bool isHistoryNavigationInNewChildFrame;
        bool isClientRedirect;

        NavigationPolicyInfo(WebURLRequest& urlRequest)
            : extraData(nullptr)
            , urlRequest(urlRequest)
            , navigationType(WebNavigationTypeOther)
            , defaultPolicy(WebNavigationPolicyIgnore)
            , replacesCurrentHistoryItem(false)
            , isHistoryNavigationInNewChildFrame(false)
            , isClientRedirect(false)
        {
        }
    };

    virtual WebNavigationPolicy decidePolicyForNavigation(const NavigationPolicyInfo& info)
    {
        return info.defaultPolicy;
    }

    // During a history navigation, we may choose to load new subframes from history as well.
    // This returns such a history item if appropriate.
    virtual WebHistoryItem historyItemForNewChildFrame() { return WebHistoryItem(); }

    // Whether the client is handling a navigation request.
    virtual bool hasPendingNavigation() { return false; }

    // Navigational notifications ------------------------------------------

    // These notifications bracket any loading that occurs in the WebFrame.
    virtual void didStartLoading(bool toDifferentDocument) { }
    virtual void didStopLoading() { }

    // Notification that some progress was made loading the current frame.
    // loadProgress is a value between 0 (nothing loaded) and 1.0 (frame fully
    // loaded).
    virtual void didChangeLoadProgress(double loadProgress) { }

    // A form submission has been requested, but the page's submit event handler
    // hasn't yet had a chance to run (and possibly alter/interrupt the submit.)
    virtual void willSendSubmitEvent(const WebFormElement&) { }

    // A form submission is about to occur.
    virtual void willSubmitForm(const WebFormElement&) { }

    // A datasource has been created for a new navigation.  The given
    // datasource will become the provisional datasource for the frame.
    virtual void didCreateDataSource(WebLocalFrame*, WebDataSource*) { }

    // A new provisional load has been started.
    virtual void didStartProvisionalLoad(WebLocalFrame* localFrame, double triggeringEventTime) { }

    // The provisional load was redirected via a HTTP 3xx response.
    virtual void didReceiveServerRedirectForProvisionalLoad(WebLocalFrame*) { }

    // The provisional load failed. The WebHistoryCommitType is the commit type
    // that would have been used had the load succeeded.
    virtual void didFailProvisionalLoad(WebLocalFrame*, const WebURLError&, WebHistoryCommitType) { }

    // The provisional datasource is now committed.  The first part of the
    // response body has been received, and the encoding of the response
    // body is known.
    virtual void didCommitProvisionalLoad(WebLocalFrame*, const WebHistoryItem&, WebHistoryCommitType) { }

    // The frame's document has just been initialized.
    virtual void didCreateNewDocument(WebLocalFrame* frame) { }

    // The window object for the frame has been cleared of any extra
    // properties that may have been set by script from the previously
    // loaded document.
    virtual void didClearWindowObject(WebLocalFrame* frame) { }

    // The document element has been created.
    // This method may not invalidate the frame, nor execute JavaScript code.
    virtual void didCreateDocumentElement(WebLocalFrame*) { }

    // Like |didCreateDocumentElement|, except this method may run JavaScript
    // code (and possibly invalidate the frame).
    virtual void runScriptsAtDocumentElementAvailable(WebLocalFrame*) { }

    // The page title is available.
    virtual void didReceiveTitle(WebLocalFrame* frame, const WebString& title, WebTextDirection direction) { }

    // The icon for the page have changed.
    virtual void didChangeIcon(WebLocalFrame*, WebIconURL::Type) { }

    // The frame's document finished loading.
    // This method may not execute JavaScript code.
    virtual void didFinishDocumentLoad(WebLocalFrame*) { }

    // Like |didFinishDocumentLoad|, except this method may run JavaScript
    // code (and possibly invalidate the frame).
    virtual void runScriptsAtDocumentReady(WebLocalFrame*, bool documentIsEmpty) { }

    // The 'load' event was dispatched.
    virtual void didHandleOnloadEvents(WebLocalFrame*) { }

    // The frame's document or one of its subresources failed to load. The
    // WebHistoryCommitType is the commit type that would have been used had the
    // load succeeded.
    virtual void didFailLoad(WebLocalFrame*, const WebURLError&, WebHistoryCommitType) { }

    // The frame's document and all of its subresources succeeded to load.
    virtual void didFinishLoad(WebLocalFrame*) { }

    // The navigation resulted in no change to the documents within the page.
    // For example, the navigation may have just resulted in scrolling to a
    // named anchor or a PopState event may have been dispatched.
    virtual void didNavigateWithinPage(WebLocalFrame*, const WebHistoryItem&, WebHistoryCommitType) { }

    // Called upon update to scroll position, document state, and other
    // non-navigational events related to the data held by WebHistoryItem.
    // WARNING: This method may be called very frequently.
    virtual void didUpdateCurrentHistoryItem() { }

    // The frame's manifest has changed.
    virtual void didChangeManifest() { }

    // The frame's theme color has changed.
    virtual void didChangeThemeColor() { }

    // Called to dispatch a load event for this frame in the FrameOwner of an
    // out-of-process parent frame.
    virtual void dispatchLoad() { }

    // Web Notifications ---------------------------------------------------

    // Requests permission to display platform notifications on the origin of this frame.
    virtual void requestNotificationPermission(const WebSecurityOrigin&, WebNotificationPermissionCallback* callback) { }


    // Push API ---------------------------------------------------

    // Used to access the embedder for the Push API.
    virtual WebPushClient* pushClient() { return 0; }


    // Presentation API ----------------------------------------------------

    // Used to access the embedder for the Presentation API.
    virtual WebPresentationClient* presentationClient() { return 0; }

    // InstalledApp API ----------------------------------------------------

    // Used to access the embedder for the InstalledApp API.
    virtual WebInstalledAppClient* installedAppClient() { return nullptr; }

    // Editing -------------------------------------------------------------

    // These methods allow the client to intercept and overrule editing
    // operations.
    virtual void didChangeSelection(bool isSelectionEmpty) { }


    // Dialogs -------------------------------------------------------------

    // This method opens the color chooser and returns a new WebColorChooser
    // instance. If there is a WebColorChooser already from the last time this
    // was called, it ends the color chooser by calling endChooser, and replaces
    // it with the new one. The given list of suggestions can be used to show a
    // simple interface with a limited set of choices.

    virtual WebColorChooser* createColorChooser(
        WebColorChooserClient*,
        const WebColor&,
        const WebVector<WebColorSuggestion>&) { return 0; }

    // Displays a modal alert dialog containing the given message. Returns
    // once the user dismisses the dialog.
    virtual void runModalAlertDialog(const WebString& message) { }

    // Displays a modal confirmation dialog with the given message as
    // description and OK/Cancel choices. Returns true if the user selects
    // 'OK' or false otherwise.
    virtual bool runModalConfirmDialog(const WebString& message) { return false; }

    // Displays a modal input dialog with the given message as description
    // and OK/Cancel choices. The input field is pre-filled with
    // defaultValue. Returns true if the user selects 'OK' or false
    // otherwise. Upon returning true, actualValue contains the value of
    // the input field.
    virtual bool runModalPromptDialog(
        const WebString& message, const WebString& defaultValue,
        WebString* actualValue) { return false; }

    // Displays a modal confirmation dialog with OK/Cancel choices, where 'OK'
    // means that it is okay to proceed with closing the view. Returns true if
    // the user selects 'OK' or false otherwise.
    virtual bool runModalBeforeUnloadDialog(bool isReload) { return true; }


    // UI ------------------------------------------------------------------

    // Shows a context menu with commands relevant to a specific element on
    // the given frame. Additional context data is supplied.
    virtual void showContextMenu(const WebContextMenuData&) { }

    // Called when the data attached to the currently displayed context menu is
    // invalidated. The context menu may be closed if possible.
    virtual void clearContextMenu() { }


    // Low-level resource notifications ------------------------------------

    // A request is about to be sent out, and the client may modify it.  Request
    // is writable, and changes to the URL, for example, will change the request
    // made.  If this request is the result of a redirect, then redirectResponse
    // will be non-null and contain the response that triggered the redirect.
    virtual void willSendRequest(
        WebLocalFrame*, unsigned identifier, WebURLRequest&,
        const WebURLResponse& redirectResponse) { }

    // Response headers have been received for the resource request given
    // by identifier.
    virtual void didReceiveResponse(unsigned identifier, const WebURLResponse&) { }

    virtual void didChangeResourcePriority(
        unsigned identifier, const WebURLRequest::Priority& priority, int) { }

    // The resource request given by identifier succeeded.
    virtual void didFinishResourceLoad(
        WebLocalFrame*, unsigned identifier) { }

    // The specified request was satified from WebCore's memory cache.
    virtual void didLoadResourceFromMemoryCache(
        const WebURLRequest&, const WebURLResponse&) { }

    // This frame has displayed inactive content (such as an image) from an
    // insecure source.  Inactive content cannot spread to other frames.
    virtual void didDisplayInsecureContent() { }

    // The indicated security origin has run active content (such as a
    // script) from an insecure source.  Note that the insecure content can
    // spread to other frames in the same origin.
    virtual void didRunInsecureContent(const WebSecurityOrigin&, const WebURL& insecureURL) { }

    // A reflected XSS was encountered in the page and suppressed.
    virtual void didDetectXSS(const WebURL&, bool didBlockEntirePage) { }

    // A PingLoader was created, and a request dispatched to a URL.
    virtual void didDispatchPingLoader(const WebURL&) { }

    // This frame has displayed inactive content (such as an image) from
    // a connection with certificate errors.
    virtual void didDisplayContentWithCertificateErrors(const WebURL& url, const WebCString& securityInfo, const WebURL& mainResourceUrl, const WebCString& mainResourceSecurityInfo) {}
    // This frame has run active content (such as a script) from a
    // connection with certificate errors.
    virtual void didRunContentWithCertificateErrors(const WebURL& url, const WebCString& securityInfo, const WebURL& mainResourceUrl, const WebCString& mainResourceSecurityInfo) {}

    // A performance timing event (e.g. first paint) occurred
    virtual void didChangePerformanceTiming() { }


    // Script notifications ------------------------------------------------

    // Notifies that a new script context has been created for this frame.
    // This is similar to didClearWindowObject but only called once per
    // frame context.
    virtual void didCreateScriptContext(WebLocalFrame*, v8::Local<v8::Context>, int extensionGroup, int worldId) { }

    // WebKit is about to release its reference to a v8 context for a frame.
    virtual void willReleaseScriptContext(WebLocalFrame*, v8::Local<v8::Context>, int worldId) { }


    // Geometry notifications ----------------------------------------------

    // The main frame scrolled.
    virtual void didChangeScrollOffset(WebLocalFrame*) { }

    // If the frame is loading an HTML document, this will be called to
    // notify that the <body> will be attached soon.
    virtual void willInsertBody(WebLocalFrame*) { }


    // Find-in-page notifications ------------------------------------------

    // Notifies how many matches have been found so far, for a given
    // identifier.  |finalUpdate| specifies whether this is the last update
    // (all frames have completed scoping). This notification is only delivered
    // to the main frame and aggregates all matches across all frames.
    virtual void reportFindInPageMatchCount(
        int identifier, int count, bool finalUpdate) { }

    // Notifies how many matches have been found in a specific frame so far,
    // for a given identifier. Unlike reprotFindInPageMatchCount(), this
    // notification is sent to the client of each frame, and only reports
    // results per-frame.
    virtual void reportFindInFrameMatchCount(
        int identifier, int count, bool finalUpdate) {}

    // Notifies what tick-mark rect is currently selected.   The given
    // identifier lets the client know which request this message belongs
    // to, so that it can choose to ignore the message if it has moved on
    // to other things.  The selection rect is expected to have coordinates
    // relative to the top left corner of the web page area and represent
    // where on the screen the selection rect is currently located.
    virtual void reportFindInPageSelection(
        int identifier, int activeMatchOrdinal, const WebRect& selection) { }

    // Currently, TextFinder will report up the frame tree on certain events to
    // form a tree of TextFinders. When we're experimenting with OOPIFs, this
    // is precisely not what we want. Experiments that want to search per frame
    // should override this to true.
    virtual bool shouldSearchSingleFrame() { return false; }

    // Quota ---------------------------------------------------------

    // Requests a new quota size for the origin's storage.
    // |newQuotaInBytes| indicates how much storage space (in bytes) the
    // caller expects to need.
    // WebStorageQuotaCallbacks::didGrantStorageQuota will be called when
    // a new quota is granted. WebStorageQuotaCallbacks::didFail
    // is called with an error code otherwise.
    // Note that the requesting quota size may not always be granted and
    // a smaller amount of quota than requested might be returned.
    virtual void requestStorageQuota(
        WebStorageQuotaType,
        unsigned long long newQuotaInBytes,
        WebStorageQuotaCallbacks) { }

    // WebSocket -----------------------------------------------------

    // A WebSocket object is going to open a new WebSocket connection.
    virtual void willOpenWebSocket(WebSocketHandle*) { }

    // Wake Lock -----------------------------------------------------

    virtual WebWakeLockClient* wakeLockClient() { return 0; }

    // Geolocation ---------------------------------------------------------

    // Access the embedder API for (client-based) geolocation client .
    virtual WebGeolocationClient* geolocationClient() { return 0; }


    // MediaStream -----------------------------------------------------

    // A new WebRTCPeerConnectionHandler is created.
    virtual void willStartUsingPeerConnectionHandler(WebRTCPeerConnectionHandler*) { }

    virtual WebUserMediaClient* userMediaClient() { return 0; }


    // Encrypted Media -------------------------------------------------

    virtual WebEncryptedMediaClient* encryptedMediaClient() { return 0; }


    // Web MIDI -------------------------------------------------------------

    virtual WebMIDIClient* webMIDIClient() { return 0; }


    // Messages ------------------------------------------------------

    // Notifies the embedder that a postMessage was issued on this frame, and
    // gives the embedder a chance to handle it instead of WebKit. Returns true
    // if the embedder handled it.
    virtual bool willCheckAndDispatchMessageEvent(
        WebLocalFrame* sourceFrame,
        WebFrame* targetFrame,
        WebSecurityOrigin target,
        WebDOMMessageEvent event) { return false; }

    // Asks the embedder if a specific user agent should be used. Non-empty
    // strings indicate an override should be used. Otherwise,
    // Platform::current()->userAgent() will be called to provide one.
    virtual WebString userAgentOverride() { return WebString(); }

    // Asks the embedder what value the network stack will send for the DNT
    // header. An empty string indicates that no DNT header will be send.
    virtual WebString doNotTrackValue() { return WebString(); }


    // WebGL ------------------------------------------------------

    // Asks the embedder whether WebGL is allowed for the WebFrame. This call is
    // placed here instead of WebContentSettingsClient because this class is
    // implemented in content/, and putting it here avoids adding more public
    // content/ APIs.
    virtual bool allowWebGL(bool defaultValue) { return defaultValue; }

    // Notifies the client that a WebGL context was lost on this page with the
    // given reason (one of the GL_ARB_robustness status codes; see
    // Extensions3D.h in WebCore/platform/graphics).
    virtual void didLoseWebGLContext(int) { }


    // Screen Orientation --------------------------------------------------

    // Access the embedder API for (client-based) screen orientation client .
    virtual WebScreenOrientationClient* webScreenOrientationClient() { return 0; }


    // Accessibility -------------------------------------------------------

    // Notifies embedder about an accessibility event.
    virtual void postAccessibilityEvent(const WebAXObject&, WebAXEvent) { }

    // Provides accessibility information about a find in page result.
    virtual void handleAccessibilityFindInPageResult(
        int identifier,
        int matchIndex,
        const WebAXObject& startObject,
        int startOffset,
        const WebAXObject& endObject,
        int endOffset) { }


    // ServiceWorker -------------------------------------------------------

    // Whether the document associated with WebDataSource is controlled by the
    // ServiceWorker.
    virtual bool isControlledByServiceWorker(WebDataSource&) { return false; }

    // Returns an identifier of the service worker controlling the document
    // associated with the WebDataSource.
    virtual int64_t serviceWorkerID(WebDataSource&) { return -1; }


    // Fullscreen ----------------------------------------------------------

    // Called to enter/exit fullscreen mode.
    // After calling enterFullscreen, WebWidget::{will,Did}EnterFullScreen
    // should bound resizing the WebWidget into fullscreen mode.
    // Similarly, when exitFullScreen is called,
    // WebWidget::{will,Did}ExitFullScreen should bound resizing the WebWidget
    // out of fullscreen mode.
    // Note: the return value is ignored.
    virtual bool enterFullscreen() { return false; }
    virtual bool exitFullscreen() { return false; }


    // Sudden termination --------------------------------------------------

    // Called when elements preventing the sudden termination of the frame
    // become present or stop being present. |type| is the type of element
    // (BeforeUnload handler, Unload handler).
    enum SuddenTerminationDisablerType {
        BeforeUnloadHandler,
        UnloadHandler,
    };
    virtual void suddenTerminationDisablerChanged(bool present, SuddenTerminationDisablerType) { }


    // Permissions ---------------------------------------------------------

    // Access the embedder API for permission client.
    virtual WebPermissionClient* permissionClient() { return 0; }

    // Virtual Reality -----------------------------------------------------

    // Access the embedder API for virtual reality client.
    virtual WebVRClient* webVRClient() { return 0; }

    // App Banners ---------------------------------------------------------
    virtual WebAppBannerClient* appBannerClient() { return 0; }

    // Navigator Content Utils  --------------------------------------------

    // Registers a new URL handler for the given protocol.
    virtual void registerProtocolHandler(const WebString& scheme,
        const WebURL& url,
        const WebString& title) { }

    // Unregisters a given URL handler for the given protocol.
    virtual void unregisterProtocolHandler(const WebString& scheme, const WebURL& url) { }

    // Check if a given URL handler is registered for the given protocol.
    virtual WebCustomHandlersState isProtocolHandlerRegistered(const WebString& scheme, const WebURL& url)
    {
        return WebCustomHandlersNew;
    }

    // Bluetooth -----------------------------------------------------------
    virtual WebBluetooth* bluetooth() { return 0; }

    // WebUSB --------------------------------------------------------------
    virtual WebUSBClient* usbClient() { return nullptr; }


    // Audio Output Devices API --------------------------------------------

    // Checks that the given audio sink exists and is authorized. The result is provided via the callbacks.
    // This method takes ownership of the callbacks pointer.
    virtual void checkIfAudioSinkExistsAndIsAuthorized(const WebString& sinkId, const WebSecurityOrigin&, WebSetSinkIdCallbacks*) { BLINK_ASSERT_NOT_REACHED(); }

protected:
    virtual ~WebFrameClient() { }
};

} // namespace blink

#endif