| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef WEBKIT_GLUE_WEBWIDGET_DELEGATE_H__ | |
| 6 #define WEBKIT_GLUE_WEBWIDGET_DELEGATE_H__ | |
| 7 | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "base/string16.h" | |
| 11 #include "webkit/glue/window_open_disposition.h" | |
| 12 | |
| 13 namespace WebKit { | |
| 14 struct WebCursorInfo; | |
| 15 struct WebRect; | |
| 16 struct WebScreenInfo; | |
| 17 } | |
| 18 | |
| 19 class WebWidget; | |
| 20 struct WebPluginGeometry; | |
| 21 | |
| 22 class WebWidgetDelegate { | |
| 23 public: | |
| 24 // Called when a region of the WebWidget needs to be re-painted. | |
| 25 virtual void DidInvalidateRect(WebWidget* webwidget, | |
| 26 const WebKit::WebRect& rect) = 0; | |
| 27 | |
| 28 // Called when a region of the WebWidget, given by clip_rect, should be | |
| 29 // scrolled by the specified dx and dy amounts. | |
| 30 virtual void DidScrollRect(WebWidget* webwidget, int dx, int dy, | |
| 31 const WebKit::WebRect& clip_rect) = 0; | |
| 32 | |
| 33 // This method is called to instruct the window containing the WebWidget to | |
| 34 // show itself as the topmost window. This method is only used after a | |
| 35 // successful call to CreateWebWidget. |disposition| indicates how this new | |
| 36 // window should be displayed, but generally only means something for | |
| 37 // WebViews. | |
| 38 virtual void Show(WebWidget* webwidget, | |
| 39 WindowOpenDisposition disposition) = 0; | |
| 40 | |
| 41 // This method is called to instruct the window containing the WebWidget to | |
| 42 // close. Note: This method should just be the trigger that causes the | |
| 43 // WebWidget to eventually close. It should not actually be destroyed until | |
| 44 // after this call returns. | |
| 45 virtual void CloseWidgetSoon(WebWidget* webwidget) = 0; | |
| 46 | |
| 47 // This method is called to focus the window containing the WebWidget so | |
| 48 // that it receives keyboard events. | |
| 49 virtual void Focus(WebWidget* webwidget) = 0; | |
| 50 | |
| 51 // This method is called to unfocus the window containing the WebWidget so tha
t | |
| 52 // it no longer receives keyboard events. | |
| 53 virtual void Blur(WebWidget* webwidget) = 0; | |
| 54 | |
| 55 virtual void SetCursor(WebWidget* webwidget, | |
| 56 const WebKit::WebCursorInfo& cursor) = 0; | |
| 57 | |
| 58 // Returns the rectangle of the WebWidget in screen coordinates. | |
| 59 virtual void GetWindowRect(WebWidget* webwidget, WebKit::WebRect* rect) = 0; | |
| 60 | |
| 61 // This method is called to re-position the WebWidget on the screen. The give
n | |
| 62 // rect is in screen coordinates. The implementation may choose to ignore | |
| 63 // this call or modify the given rect. This method may be called before Show | |
| 64 // has been called. | |
| 65 // TODO(darin): this is more of a request; does this need to take effect | |
| 66 // synchronously? | |
| 67 virtual void SetWindowRect(WebWidget* webwidget, | |
| 68 const WebKit::WebRect& rect) = 0; | |
| 69 | |
| 70 // Returns the rectangle of the window in which this WebWidget is embeded. | |
| 71 virtual void GetRootWindowRect(WebWidget* webwidget, | |
| 72 WebKit::WebRect* rect) = 0; | |
| 73 | |
| 74 // Returns the resizer rectangle of the window this WebWidget is in. This | |
| 75 // is used on Mac to determine if a scrollbar is over the in-window resize | |
| 76 // area at the bottom right corner. | |
| 77 virtual void GetRootWindowResizerRect(WebWidget* webwidget, | |
| 78 WebKit::WebRect* rect) = 0; | |
| 79 | |
| 80 // Keeps track of the necessary window move for a plugin window that resulted | |
| 81 // from a scroll operation. That way, all plugin windows can be moved at the | |
| 82 // same time as each other and the page. | |
| 83 virtual void DidMove(WebWidget* webwidget, const WebPluginGeometry& move) = 0; | |
| 84 | |
| 85 // Suppress input events to other windows, and do not return until the widget | |
| 86 // is closed. This is used to support |window.showModalDialog|. | |
| 87 virtual void RunModal(WebWidget* webwidget) = 0; | |
| 88 | |
| 89 // Returns true if the widget is in a background tab. | |
| 90 virtual bool IsHidden(WebWidget* webwidget) = 0; | |
| 91 | |
| 92 // Returns information about the screen associated with this widget. | |
| 93 virtual WebKit::WebScreenInfo GetScreenInfo(WebWidget* webwidget) = 0; | |
| 94 | |
| 95 WebWidgetDelegate() { } | |
| 96 virtual ~WebWidgetDelegate() { } | |
| 97 | |
| 98 private: | |
| 99 DISALLOW_COPY_AND_ASSIGN(WebWidgetDelegate); | |
| 100 }; | |
| 101 | |
| 102 #endif // #ifndef WEBKIT_GLUE_WEBWIDGET_DELEGATE_H__ | |
| OLD | NEW |