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 WebWidgetClient_h 32 #define WebWidgetClient_h 33 34 #include "WebCommon.h" 35 #include "WebNavigationPolicy.h" 36 #include "WebRect.h" 37 #include "WebScreenInfo.h" 38 39 namespace WebKit { 40 41 class WebWidget; 42 struct WebCursorInfo; 43 44 class WebWidgetClient { 45 public: 46 // Called when a region of the WebWidget needs to be re-painted. didInvalidateRect(const WebRect &)47 virtual void didInvalidateRect(const WebRect&) { } 48 49 // Called when a region of the WebWidget, given by clipRect, should be 50 // scrolled by the specified dx and dy amounts. didScrollRect(int dx,int dy,const WebRect & clipRect)51 virtual void didScrollRect(int dx, int dy, const WebRect& clipRect) { } 52 53 // Called when the compositor enables or disables. didActivateAcceleratedCompositing(bool active)54 virtual void didActivateAcceleratedCompositing(bool active) { } 55 56 // Called when a call to WebWidget::composite is required scheduleComposite()57 virtual void scheduleComposite() { } 58 59 // Called when a call to WebWidget::animate is required scheduleAnimation()60 virtual void scheduleAnimation() { } 61 62 // Called when the widget acquires or loses focus, respectively. didFocus()63 virtual void didFocus() { } didBlur()64 virtual void didBlur() { } 65 66 // Called when the cursor for the widget changes. didChangeCursor(const WebCursorInfo &)67 virtual void didChangeCursor(const WebCursorInfo&) { } 68 69 // Called when the widget should be closed. WebWidget::close() should 70 // be called asynchronously as a result of this notification. closeWidgetSoon()71 virtual void closeWidgetSoon() { } 72 73 // Called to show the widget according to the given policy. show(WebNavigationPolicy)74 virtual void show(WebNavigationPolicy) { } 75 76 // Called to block execution of the current thread until the widget is 77 // closed. runModal()78 virtual void runModal() { } 79 80 // Called to get/set the position of the widget in screen coordinates. windowRect()81 virtual WebRect windowRect() { return WebRect(); } setWindowRect(const WebRect &)82 virtual void setWindowRect(const WebRect&) { } 83 84 // Called to get the position of the resizer rect in window coordinates. windowResizerRect()85 virtual WebRect windowResizerRect() { return WebRect(); } 86 87 // Called to get the position of the root window containing the widget 88 // in screen coordinates. rootWindowRect()89 virtual WebRect rootWindowRect() { return WebRect(); } 90 91 // Called to query information about the screen where this widget is 92 // displayed. screenInfo()93 virtual WebScreenInfo screenInfo() { return WebScreenInfo(); } 94 95 // When this method gets called, WebWidgetClient implementation should 96 // reset the input method by cancelling any ongoing composition. resetInputMethod()97 virtual void resetInputMethod() { } 98 99 protected: ~WebWidgetClient()100 ~WebWidgetClient() { } 101 }; 102 103 } // namespace WebKit 104 105 #endif 106