| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef WEBKIT_GLUE_WEBWIDGET_DELEGATE_H__ | 5 #ifndef WEBKIT_GLUE_WEBWIDGET_DELEGATE_H__ |
| 6 #define WEBKIT_GLUE_WEBWIDGET_DELEGATE_H__ | 6 #define WEBKIT_GLUE_WEBWIDGET_DELEGATE_H__ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| 11 #include "webkit/glue/window_open_disposition.h" | 11 #include "webkit/glue/window_open_disposition.h" |
| 12 | 12 |
| 13 namespace WebKit { | 13 namespace WebKit { |
| 14 struct WebCursorInfo; | 14 struct WebCursorInfo; |
| 15 struct WebRect; | 15 struct WebRect; |
| 16 struct WebScreenInfo; | 16 struct WebScreenInfo; |
| 17 } | 17 } |
| 18 | 18 |
| 19 class WebWidget; | 19 class WebWidget; |
| 20 struct WebPluginGeometry; | 20 struct WebPluginGeometry; |
| 21 | 21 |
| 22 struct WebMenuItem { | |
| 23 // Container for information about entries in an HTML select popup menu. | |
| 24 // Types must be kept in sync with PopupListBox::ListItemType in | |
| 25 // WebCore/platform/chromium/PopupMenuChromium.h. This won't change often | |
| 26 // (if ever). | |
| 27 enum Type { | |
| 28 OPTION = 0, | |
| 29 GROUP, | |
| 30 SEPARATOR | |
| 31 }; | |
| 32 | |
| 33 string16 label; | |
| 34 Type type; | |
| 35 bool enabled; | |
| 36 }; | |
| 37 | |
| 38 class WebWidgetDelegate { | 22 class WebWidgetDelegate { |
| 39 public: | 23 public: |
| 40 // Called when a region of the WebWidget needs to be re-painted. | 24 // Called when a region of the WebWidget needs to be re-painted. |
| 41 virtual void DidInvalidateRect(WebWidget* webwidget, | 25 virtual void DidInvalidateRect(WebWidget* webwidget, |
| 42 const WebKit::WebRect& rect) = 0; | 26 const WebKit::WebRect& rect) = 0; |
| 43 | 27 |
| 44 // Called when a region of the WebWidget, given by clip_rect, should be | 28 // Called when a region of the WebWidget, given by clip_rect, should be |
| 45 // scrolled by the specified dx and dy amounts. | 29 // scrolled by the specified dx and dy amounts. |
| 46 virtual void DidScrollRect(WebWidget* webwidget, int dx, int dy, | 30 virtual void DidScrollRect(WebWidget* webwidget, int dx, int dy, |
| 47 const WebKit::WebRect& clip_rect) = 0; | 31 const WebKit::WebRect& clip_rect) = 0; |
| 48 | 32 |
| 49 // This method is called to instruct the window containing the WebWidget to | 33 // This method is called to instruct the window containing the WebWidget to |
| 50 // show itself as the topmost window. This method is only used after a | 34 // show itself as the topmost window. This method is only used after a |
| 51 // successful call to CreateWebWidget. |disposition| indicates how this new | 35 // successful call to CreateWebWidget. |disposition| indicates how this new |
| 52 // window should be displayed, but generally only means something for | 36 // window should be displayed, but generally only means something for |
| 53 // WebViews. | 37 // WebViews. |
| 54 virtual void Show(WebWidget* webwidget, | 38 virtual void Show(WebWidget* webwidget, |
| 55 WindowOpenDisposition disposition) = 0; | 39 WindowOpenDisposition disposition) = 0; |
| 56 | 40 |
| 57 // Used for displaying HTML popup menus on Mac OS X (other platforms will use | |
| 58 // Show() above). |bounds| represents the positioning on the screen (in WebKit | |
| 59 // coordinates, origin at the top left corner) of the button that will display | |
| 60 // the menu. It will be used, along with |item_height| (which refers to the | |
| 61 // size of each entry in the menu), to position the menu on the screen. | |
| 62 // |selected_index| indicates the menu item that should be drawn as selected | |
| 63 // when the menu initially is displayed. |items| contains information about | |
| 64 // each of the entries in the popup menu, such as the type (separator, option, | |
| 65 // group), the text representation and the item's enabled status. | |
| 66 virtual void ShowAsPopupWithItems(WebWidget* webwidget, | |
| 67 const WebKit::WebRect& bounds, | |
| 68 int item_height, | |
| 69 int selected_index, | |
| 70 const std::vector<WebMenuItem>& items) = 0; | |
| 71 | |
| 72 // This method is called to instruct the window containing the WebWidget to | 41 // This method is called to instruct the window containing the WebWidget to |
| 73 // close. Note: This method should just be the trigger that causes the | 42 // close. Note: This method should just be the trigger that causes the |
| 74 // WebWidget to eventually close. It should not actually be destroyed until | 43 // WebWidget to eventually close. It should not actually be destroyed until |
| 75 // after this call returns. | 44 // after this call returns. |
| 76 virtual void CloseWidgetSoon(WebWidget* webwidget) = 0; | 45 virtual void CloseWidgetSoon(WebWidget* webwidget) = 0; |
| 77 | 46 |
| 78 // This method is called to focus the window containing the WebWidget so | 47 // This method is called to focus the window containing the WebWidget so |
| 79 // that it receives keyboard events. | 48 // that it receives keyboard events. |
| 80 virtual void Focus(WebWidget* webwidget) = 0; | 49 virtual void Focus(WebWidget* webwidget) = 0; |
| 81 | 50 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 virtual WebKit::WebScreenInfo GetScreenInfo(WebWidget* webwidget) = 0; | 93 virtual WebKit::WebScreenInfo GetScreenInfo(WebWidget* webwidget) = 0; |
| 125 | 94 |
| 126 WebWidgetDelegate() { } | 95 WebWidgetDelegate() { } |
| 127 virtual ~WebWidgetDelegate() { } | 96 virtual ~WebWidgetDelegate() { } |
| 128 | 97 |
| 129 private: | 98 private: |
| 130 DISALLOW_COPY_AND_ASSIGN(WebWidgetDelegate); | 99 DISALLOW_COPY_AND_ASSIGN(WebWidgetDelegate); |
| 131 }; | 100 }; |
| 132 | 101 |
| 133 #endif // #ifndef WEBKIT_GLUE_WEBWIDGET_DELEGATE_H__ | 102 #endif // #ifndef WEBKIT_GLUE_WEBWIDGET_DELEGATE_H__ |
| OLD | NEW |