#ifndef WebViewClient_h
#define WebViewClient_h
-#include "../platform/WebColor.h"
#include "../platform/WebGraphicsContext3D.h"
#include "../platform/WebString.h"
#include "WebAXEnums.h"
#include "WebDragOperation.h"
#include "WebFileChooserCompletion.h"
#include "WebFileChooserParams.h"
+#include "WebFrame.h"
+#include "WebNavigatorContentUtilsClient.h"
#include "WebPageVisibilityState.h"
#include "WebPopupType.h"
#include "WebTextAffinity.h"
#include "WebTextDirection.h"
#include "WebWidgetClient.h"
-namespace WebKit {
+namespace blink {
class WebAXObject;
-class WebColorChooser;
-class WebColorChooserClient;
class WebCompositorOutputSurface;
class WebDateTimeChooserCompletion;
class WebDragData;
class WebElement;
-class WebExternalPopupMenu;
-class WebExternalPopupMenuClient;
class WebFileChooserCompletion;
-class WebFrame;
-class WebGeolocationClient;
-class WebGeolocationService;
class WebGestureEvent;
-class WebHelperPlugin;
class WebHitTestResult;
class WebImage;
class WebInputElement;
class WebKeyboardEvent;
-class WebMIDIClient;
class WebNode;
-class WebNotificationPresenter;
+class WebPushClient;
class WebRange;
-class WebSpeechInputController;
-class WebSpeechInputListener;
class WebSpeechRecognizer;
class WebStorageNamespace;
class WebURL;
class WebURLRequest;
-class WebUserMediaClient;
class WebView;
class WebWidget;
struct WebConsoleMessage;
-struct WebContextMenuData;
struct WebDateTimeChooserParams;
struct WebPoint;
struct WebPopupMenuInfo;
// could be fulfilled. The client should not load the request.
// The policy parameter indicates how the new view will be displayed in
// WebWidgetClient::show.
- virtual WebView* createView(WebFrame* creator,
+ virtual WebView* createView(WebLocalFrame* creator,
const WebURLRequest& request,
const WebWindowFeatures& features,
const WebString& name,
- WebNavigationPolicy policy) {
+ WebNavigationPolicy policy,
+ bool suppressOpener) {
return 0;
}
- // Create a new WebPopupMenu. In the second form, the client is
- // responsible for rendering the contents of the popup menu.
+ // Create a new WebPopupMenu.
virtual WebWidget* createPopupMenu(WebPopupType) { return 0; }
virtual WebWidget* createPopupMenu(const WebPopupMenuInfo&) { return 0; }
- virtual WebExternalPopupMenu* createExternalPopupMenu(
- const WebPopupMenuInfo&, WebExternalPopupMenuClient*) { return 0; }
// Create a session storage namespace object associated with this WebView.
virtual WebStorageNamespace* createSessionStorageNamespace() { return 0; }
// Misc ----------------------------------------------------------------
- // 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) { }
-
// Called when script in the page calls window.print(). If frame is
// non-null, then it selects a particular frame, including its
// children, to print. Otherwise, the main frame and its children
// should be printed.
- virtual void printPage(WebFrame*) { }
-
- // Called to retrieve the provider of desktop notifications.
- virtual WebNotificationPresenter* notificationPresenter() { return 0; }
+ virtual void printPage(WebLocalFrame*) { }
// This method enumerates all the files in the path. It returns immediately
// and asynchronously invokes the WebFileChooserCompletion with all the
// will never be called.
virtual bool enumerateChosenDirectory(const WebString& path, WebFileChooserCompletion*) { return false; }
- // Creates the main WebFrame for the specified WebHelperPlugin.
- // Called by WebHelperPlugin to provide the WebFrameClient interface for the WebFrame.
- virtual void initializeHelperPluginWebFrame(WebHelperPlugin*) { }
-
- // Navigational --------------------------------------------------------
+ // This method is called in response to WebView's saveImageAt(x, y).
+ // A data url from <canvas> or <img> is passed to the method's argument.
+ virtual void saveImageFromDataURL(const WebString&) { }
- // These notifications bracket any loading that occurs in the WebView.
- virtual void didStartLoading() { }
- virtual void didStopLoading() { }
-
- // Notification that some progress was made loading the current page.
- // loadProgress is a value between 0 (nothing loaded) and 1.0 (frame fully
- // loaded).
- virtual void didChangeLoadProgress(WebFrame*, double loadProgress) { }
// Editing -------------------------------------------------------------
// These methods allow the client to intercept and overrule editing
// operations.
virtual void didCancelCompositionOnSelectionChange() { }
- virtual void didChangeSelection(bool isSelectionEmpty) { }
virtual void didChangeContents() { }
- virtual void didExecuteCommand(const WebString& commandName) { }
// This method is called in response to WebView's handleInputEvent()
// when the default action for the current keyboard event is not
// indicating that the default action should be suppressed.
virtual bool handleCurrentKeyboardEvent() { return false; }
- // 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.
- virtual WebColorChooser* createColorChooser(WebColorChooserClient*,
- const WebColor&) { return 0; }
+ // Dialogs -------------------------------------------------------------
// This method returns immediately after showing the dialog. When the
// dialog is closed, it should call the WebFileChooserCompletion to
// Show a notification popup for the specified form vaidation messages
// besides the anchor rectangle. An implementation of this function should
// not hide the popup until hideValidationMessage call.
- virtual void showValidationMessage(const WebRect& anchorInRootView, const WebString& mainText, const WebString& supplementalText, WebTextDirection hint) { }
+ virtual void showValidationMessage(const WebRect& anchorInRootView, const WebString& mainText, WebTextDirection mainTextDir, const WebString& supplementalText, WebTextDirection supplementalTextDir) { }
// Hide notifation popup for form validation messages.
virtual void hideValidationMessage() { }
// Move the existing notifation popup to the new anchor position.
virtual void moveValidationMessage(const WebRect& anchorInRootView) { }
- // Displays a modal alert dialog containing the given message. Returns
- // once the user dismisses the dialog.
- virtual void runModalAlertDialog(
- WebFrame*, 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(
- WebFrame*, 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(
- WebFrame*, const WebString& message, const WebString& defaultValue,
- WebString* actualValue) { return false; }
-
- // Displays a modal confirmation dialog containing the given message as
- // description and 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(
- WebFrame*, const WebString& message) { return true; }
-
// UI ------------------------------------------------------------------
// Called when keyboard focus switches to an anchor with the given URL.
virtual void setKeyboardFocusURL(const WebURL&) { }
- // Shows a context menu with commands relevant to a specific element on
- // the given frame. Additional context data is supplied.
- virtual void showContextMenu(WebFrame*, 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() { }
-
// Called when a drag-n-drop operation should begin.
- virtual void startDragging(WebFrame*, const WebDragData&, WebDragOperationsMask, const WebImage&, const WebPoint& dragImageOffset) { }
+ virtual void startDragging(WebLocalFrame*, const WebDragData&, WebDragOperationsMask, const WebImage&, const WebPoint& dragImageOffset) { }
// Called to determine if drag-n-drop operations may initiate a page
// navigation.
// Called when a new node gets focused.
virtual void focusedNodeChanged(const WebNode&) { }
- virtual void numberOfWheelEventHandlersChanged(unsigned) { }
-
// Indicates two things:
// 1) This view may have a new layout now.
// 2) Calling layout() is a no-op.
// unless the view did not need a layout.
virtual void didUpdateLayout() { }
+ // FIXME: This is a deprecated method. Remove it after the chromium change
+ // that uses the second didTapMultipleTargets() propagates.
+ //
// Return true to swallow the input event if the embedder will start a disambiguation popup
virtual bool didTapMultipleTargets(const WebGestureEvent&, const WebVector<WebRect>& targetRects) { return false; }
+ // Return true to swallow the input event if the embedder will start a disambiguation popup
+ virtual bool didTapMultipleTargets(const WebSize& pinchViewportOffset, const WebRect& touchRect, const WebVector<WebRect>& targetRects) { return false; }
+
// Returns comma separated list of accept languages.
virtual WebString acceptLanguages() { return WebString(); }
+
// Session history -----------------------------------------------------
// Tells the embedder to navigate back or forward in session history by
// Notifies embedder about an accessibility event.
virtual void postAccessibilityEvent(const WebAXObject&, WebAXEvent) { }
+
// Developer tools -----------------------------------------------------
// Called to notify the client that the inspector's settings were
virtual void didUpdateInspectorSetting(const WebString& key, const WebString& value) { }
- // Geolocation ---------------------------------------------------------
-
- // Access the embedder API for (client-based) geolocation client .
- virtual WebGeolocationClient* geolocationClient() { return 0; }
- // Access the embedder API for (non-client-based) geolocation services.
- virtual WebGeolocationService* geolocationService() { return 0; }
// Speech --------------------------------------------------------------
- // Access the embedder API for speech input services.
- virtual WebSpeechInputController* speechInputController(
- WebSpeechInputListener*) { return 0; }
-
// Access the embedder API for speech recognition services.
virtual WebSpeechRecognizer* speechRecognizer() { return 0; }
+
// Zoom ----------------------------------------------------------------
// Informs the browser that the zoom levels for this frame have changed from
// action that wasn't initiated by the client.
virtual void zoomLevelChanged() { }
+
+ // Navigator Content Utils --------------------------------------------
+
// Registers a new URL handler for the given protocol.
virtual void registerProtocolHandler(const WebString& scheme,
- const WebString& baseUrl,
- const WebString& url,
- const WebString& title) { }
+ 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;
+ }
+
// Visibility -----------------------------------------------------------
return WebPageVisibilityStateVisible;
}
- // Media Streams -------------------------------------------------------
-
- virtual WebUserMediaClient* userMediaClient() { return 0; }
- // Web MIDI -------------------------------------------------------------
+ // Push Messaging -------------------------------------------------------
- virtual WebMIDIClient* webMIDIClient() { return 0; }
+ virtual WebPushClient* webPushClient() { return 0; }
// Content detection ----------------------------------------------------
// Cancels any previously scheduled content intents that have not yet launched.
virtual void cancelScheduledContentIntents() { }
+
// Draggable regions ----------------------------------------------------
// Informs the browser that the draggable regions have been updated.
~WebViewClient() { }
};
-} // namespace WebKit
+} // namespace blink
#endif