| 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_WEBWIDGETCLIENT_H_ | |
| 32 #define SKY_ENGINE_PUBLIC_WEB_WEBWIDGETCLIENT_H_ | |
| 33 | |
| 34 #include "sky/engine/public/platform/WebCommon.h" | |
| 35 #include "sky/engine/public/platform/WebLayerTreeView.h" | |
| 36 #include "sky/engine/public/platform/WebRect.h" | |
| 37 #include "sky/engine/public/platform/WebScreenInfo.h" | |
| 38 #include "sky/engine/public/web/WebNavigationPolicy.h" | |
| 39 #include "sky/engine/public/web/WebTouchAction.h" | |
| 40 | |
| 41 namespace blink { | |
| 42 | |
| 43 class WebString; | |
| 44 class WebWidget; | |
| 45 struct WebCursorInfo; | |
| 46 struct WebSize; | |
| 47 | |
| 48 class WebWidgetClient { | |
| 49 public: | |
| 50 // Called when the Widget has changed size as a result of an auto-resize. | |
| 51 virtual void didAutoResize(const WebSize& newSize) { } | |
| 52 | |
| 53 // Initialize compositing for this widget. | |
| 54 virtual void initializeLayerTreeView() { BLINK_ASSERT_NOT_REACHED(); }; | |
| 55 | |
| 56 // Indicates to the embedder that the compositor is about to begin a | |
| 57 // frame. This is primarily to signal to flow control mechanisms that a | |
| 58 // frame is beginning, not to perform actual painting work. | |
| 59 virtual void willBeginCompositorFrame() { } | |
| 60 | |
| 61 // Indicates to the embedder that the WebWidget is ready for additional | |
| 62 // input. | |
| 63 virtual void didBecomeReadyForAdditionalInput() { } | |
| 64 | |
| 65 // Called for compositing mode when a frame commit operation has finished. | |
| 66 virtual void didCommitCompositorFrame() { } | |
| 67 | |
| 68 // Called for compositing mode when the draw commands for a WebKit-side | |
| 69 // frame have been issued. | |
| 70 virtual void didCommitAndDrawCompositorFrame() { } | |
| 71 | |
| 72 // Called for compositing mode when swapbuffers has been posted in the GPU | |
| 73 // process. | |
| 74 virtual void didCompleteSwapBuffers() { } | |
| 75 | |
| 76 // Called when a call to WebWidget::animate is required | |
| 77 virtual void scheduleAnimation() { } | |
| 78 | |
| 79 // Called when the widget acquires or loses focus, respectively. | |
| 80 virtual void didFocus() { } | |
| 81 virtual void didBlur() { } | |
| 82 | |
| 83 // Called when the cursor for the widget changes. | |
| 84 virtual void didChangeCursor(const WebCursorInfo&) { } | |
| 85 | |
| 86 // Called when the widget should be closed. WebWidget::close() should | |
| 87 // be called asynchronously as a result of this notification. | |
| 88 virtual void closeWidgetSoon() { } | |
| 89 | |
| 90 // Called to show the widget according to the given policy. | |
| 91 virtual void show(WebNavigationPolicy) { } | |
| 92 | |
| 93 // Called to enter/exit fullscreen mode. If enterFullScreen returns true, | |
| 94 // then WebWidget::{will,Did}EnterFullScreen should bound resizing the | |
| 95 // WebWidget into fullscreen mode. Similarly, when exitFullScreen is | |
| 96 // called, WebWidget::{will,Did}ExitFullScreen should bound resizing the | |
| 97 // WebWidget out of fullscreen mode. | |
| 98 virtual bool enterFullScreen() { return false; } | |
| 99 virtual void exitFullScreen() { } | |
| 100 | |
| 101 // Called to get/set the position of the widget in screen coordinates. | |
| 102 virtual WebRect windowRect() { return WebRect(); } | |
| 103 virtual void setWindowRect(const WebRect&) { } | |
| 104 | |
| 105 // Called to get the position of the resizer rect in window coordinates. | |
| 106 virtual WebRect windowResizerRect() { return WebRect(); } | |
| 107 | |
| 108 // Called to get the position of the root window containing the widget | |
| 109 // in screen coordinates. | |
| 110 virtual WebRect rootWindowRect() { return WebRect(); } | |
| 111 | |
| 112 // Called to query information about the screen where this widget is | |
| 113 // displayed. | |
| 114 virtual WebScreenInfo screenInfo() { return WebScreenInfo(); } | |
| 115 | |
| 116 // Called to get the scale factor of the display. | |
| 117 virtual float deviceScaleFactor() { return 1; } | |
| 118 | |
| 119 // When this method gets called, WebWidgetClient implementation should | |
| 120 // reset the input method by cancelling any ongoing composition. | |
| 121 virtual void resetInputMethod() { } | |
| 122 | |
| 123 // Called during WebWidget::HandleInputEvent for a TouchStart event to infor
m the embedder | |
| 124 // of the touch actions that are permitted for this touch. | |
| 125 virtual void setTouchAction(WebTouchAction touchAction) { } | |
| 126 | |
| 127 // Called when value of focused text field gets dirty, e.g. value is | |
| 128 // modified by script, not by user input. | |
| 129 virtual void didUpdateTextOfFocusedElementByNonUserInput() { } | |
| 130 | |
| 131 // Request the browser to show the IME for current input type. | |
| 132 virtual void showImeIfNeeded() { } | |
| 133 | |
| 134 protected: | |
| 135 ~WebWidgetClient() { } | |
| 136 }; | |
| 137 | |
| 138 } // namespace blink | |
| 139 | |
| 140 #endif // SKY_ENGINE_PUBLIC_WEB_WEBWIDGETCLIENT_H_ | |
| OLD | NEW |