| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | |
| 3 * | |
| 4 * Redistribution and use in source and binary forms, with or without | |
| 5 * modification, are permitted provided that the following conditions are | |
| 6 * met: | |
| 7 * | |
| 8 * * Redistributions of source code must retain the above copyright | |
| 9 * notice, this list of conditions and the following disclaimer. | |
| 10 * * Redistributions in binary form must reproduce the above | |
| 11 * copyright notice, this list of conditions and the following disclaimer | |
| 12 * in the documentation and/or other materials provided with the | |
| 13 * distribution. | |
| 14 * * Neither the name of Google Inc. nor the names of its | |
| 15 * contributors may be used to endorse or promote products derived from | |
| 16 * this software without specific prior written permission. | |
| 17 * | |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 29 */ | |
| 30 | |
| 31 #ifndef SKY_ENGINE_PUBLIC_WEB_WEBVIEWCLIENT_H_ | |
| 32 #define SKY_ENGINE_PUBLIC_WEB_WEBVIEWCLIENT_H_ | |
| 33 | |
| 34 #include "../platform/WebGraphicsContext3D.h" | |
| 35 #include "../platform/WebString.h" | |
| 36 #include "sky/engine/public/platform/WebCommon.h" | |
| 37 #include "sky/engine/public/platform/WebRect.h" | |
| 38 #include "sky/engine/public/platform/WebScreenInfo.h" | |
| 39 #include "sky/engine/public/web/WebFrame.h" | |
| 40 #include "sky/engine/public/web/WebNavigatorContentUtilsClient.h" | |
| 41 #include "sky/engine/public/web/WebPageVisibilityState.h" | |
| 42 #include "sky/engine/public/web/WebTextAffinity.h" | |
| 43 #include "sky/engine/public/web/WebTextDirection.h" | |
| 44 | |
| 45 namespace blink { | |
| 46 | |
| 47 class ServiceProvider; | |
| 48 class WebElement; | |
| 49 class WebImage; | |
| 50 class WebKeyboardEvent; | |
| 51 class WebNode; | |
| 52 class WebRange; | |
| 53 class WebURL; | |
| 54 class WebURLRequest; | |
| 55 class WebView; | |
| 56 class WebWidget; | |
| 57 struct WebConsoleMessage; | |
| 58 struct WebPoint; | |
| 59 struct WebRect; | |
| 60 struct WebSize; | |
| 61 | |
| 62 class WebViewClient { | |
| 63 public: | |
| 64 virtual ServiceProvider* services() { return nullptr; } | |
| 65 | |
| 66 // Initialize compositing for this widget. | |
| 67 virtual void initializeLayerTreeView() { BLINK_ASSERT_NOT_REACHED(); }; | |
| 68 | |
| 69 // Called when the page should pump a frame. | |
| 70 virtual void scheduleVisualUpdate() { } | |
| 71 | |
| 72 // TODO(esprehn): Sky needs to implement these to control the mojo::View. | |
| 73 | |
| 74 // Called to get/set the position of the widget in screen coordinates. | |
| 75 virtual WebRect windowRect() { return WebRect(); } | |
| 76 virtual void setWindowRect(const WebRect&) { } | |
| 77 | |
| 78 // Called to get the position of the root window containing the widget | |
| 79 // in screen coordinates. | |
| 80 virtual WebRect rootWindowRect() { return WebRect(); } | |
| 81 | |
| 82 // Called to query information about the screen where this widget is | |
| 83 // displayed. | |
| 84 virtual WebScreenInfo screenInfo() { return WebScreenInfo(); } | |
| 85 | |
| 86 // Called to get the scale factor of the display. | |
| 87 virtual float deviceScaleFactor() { return 1; } | |
| 88 | |
| 89 // Editing ------------------------------------------------------------- | |
| 90 | |
| 91 // This method is called in response to WebView's handleInputEvent() | |
| 92 // when the default action for the current keyboard event is not | |
| 93 // suppressed by the page, to give the embedder a chance to handle | |
| 94 // the keyboard event specially. | |
| 95 // | |
| 96 // Returns true if the keyboard event was handled by the embedder, | |
| 97 // indicating that the default action should be suppressed. | |
| 98 virtual bool handleCurrentKeyboardEvent() { return false; } | |
| 99 | |
| 100 // UI ------------------------------------------------------------------ | |
| 101 | |
| 102 // Called when script modifies window.status | |
| 103 virtual void setStatusText(const WebString&) { } | |
| 104 | |
| 105 // Called to determine if drag-n-drop operations may initiate a page | |
| 106 // navigation. | |
| 107 virtual bool acceptsLoadDrops() { return true; } | |
| 108 | |
| 109 // Take focus away from the WebView by focusing an adjacent UI element | |
| 110 // in the containing window. | |
| 111 virtual void focusNext() { } | |
| 112 virtual void focusPrevious() { } | |
| 113 | |
| 114 // Called when a new node gets focused. | |
| 115 virtual void focusedNodeChanged(const WebNode&) { } | |
| 116 | |
| 117 // Returns comma separated list of accept languages. | |
| 118 virtual WebString acceptLanguages() { return WebString(); } | |
| 119 | |
| 120 // Developer tools ----------------------------------------------------- | |
| 121 | |
| 122 // Called to notify the client that the inspector's settings were | |
| 123 // changed and should be saved. See WebView::inspectorSettings. | |
| 124 virtual void didUpdateInspectorSettings() { } | |
| 125 | |
| 126 virtual void didUpdateInspectorSetting(const WebString& key, const WebString
& value) { } | |
| 127 | |
| 128 // Navigator Content Utils -------------------------------------------- | |
| 129 | |
| 130 // Registers a new URL handler for the given protocol. | |
| 131 virtual void registerProtocolHandler(const WebString& scheme, | |
| 132 const WebURL& baseUrl, | |
| 133 const WebURL& url, | |
| 134 const WebString& title) { } | |
| 135 | |
| 136 // Unregisters a given URL handler for the given protocol. | |
| 137 virtual void unregisterProtocolHandler(const WebString& scheme, const WebURL
& baseUrl, const WebURL& url) { } | |
| 138 | |
| 139 // Check if a given URL handler is registered for the given protocol. | |
| 140 virtual WebCustomHandlersState isProtocolHandlerRegistered(const WebString&
scheme, const WebURL& baseUrl, const WebURL& url) | |
| 141 { | |
| 142 return WebCustomHandlersNew; | |
| 143 } | |
| 144 | |
| 145 | |
| 146 // Visibility ----------------------------------------------------------- | |
| 147 | |
| 148 // Returns the current visibility of the WebView. | |
| 149 virtual WebPageVisibilityState visibilityState() const | |
| 150 { | |
| 151 return WebPageVisibilityStateVisible; | |
| 152 } | |
| 153 | |
| 154 protected: | |
| 155 ~WebViewClient() { } | |
| 156 }; | |
| 157 | |
| 158 } // namespace blink | |
| 159 | |
| 160 #endif // SKY_ENGINE_PUBLIC_WEB_WEBVIEWCLIENT_H_ | |
| OLD | NEW |