Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: webkit/glue/webwidget_delegate.h

Issue 48149: Use cocoa controls for HTML select popups in test_shell (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <string>
9 #include <vector>
10
8 #include "base/gfx/native_widget_types.h" 11 #include "base/gfx/native_widget_types.h"
12 #include "base/string16.h"
9 #include "webkit/glue/window_open_disposition.h" 13 #include "webkit/glue/window_open_disposition.h"
10 14
11 namespace gfx { 15 namespace gfx {
12 class Point; 16 class Point;
13 class Rect; 17 class Rect;
14 } 18 }
15 19
16 class WebWidget; 20 class WebWidget;
17 class WebCursor; 21 class WebCursor;
18 struct WebPluginGeometry; 22 struct WebPluginGeometry;
19 23
24 struct MenuItem {
darin (slow to review) 2009/04/01 18:02:50 sorry for the after-the-fact review... MenuItem s
25 // Container for information about entries in an HTML select popup menu.
26 // Types must be kept in sync with PopupListBox::ListItemType in
27 // WebCore/platform/chromium/PopupMenuChromium.h. This won't change often
28 // (if ever).
29 enum Type {
30 OPTION = 0,
31 GROUP,
32 SEPARATOR
33 };
34
35 string16 label;
36 Type type;
37 bool enabled;
38 };
39
20 class WebWidgetDelegate { 40 class WebWidgetDelegate {
21 public: 41 public:
22 // Returns the view in which the WebWidget is embedded. 42 // Returns the view in which the WebWidget is embedded.
23 virtual gfx::NativeViewId GetContainingView(WebWidget* webwidget) = 0; 43 virtual gfx::NativeViewId GetContainingView(WebWidget* webwidget) = 0;
24 44
25 // Called when a region of the WebWidget needs to be re-painted. 45 // Called when a region of the WebWidget needs to be re-painted.
26 virtual void DidInvalidateRect(WebWidget* webwidget, const gfx::Rect& rect) = 0; 46 virtual void DidInvalidateRect(WebWidget* webwidget, const gfx::Rect& rect) = 0;
27 47
28 // Called when a region of the WebWidget, given by clip_rect, should be 48 // Called when a region of the WebWidget, given by clip_rect, should be
29 // scrolled by the specified dx and dy amounts. 49 // scrolled by the specified dx and dy amounts.
30 virtual void DidScrollRect(WebWidget* webwidget, int dx, int dy, 50 virtual void DidScrollRect(WebWidget* webwidget, int dx, int dy,
31 const gfx::Rect& clip_rect) = 0; 51 const gfx::Rect& clip_rect) = 0;
32 52
33 // This method is called to instruct the window containing the WebWidget to 53 // 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 54 // show itself as the topmost window. This method is only used after a
35 // successful call to CreateWebWidget. |disposition| indicates how this new 55 // successful call to CreateWebWidget. |disposition| indicates how this new
36 // window should be displayed, but generally only means something for WebViews . 56 // window should be displayed, but generally only means something for WebViews .
37 virtual void Show(WebWidget* webwidget, WindowOpenDisposition disposition) = 0 ; 57 virtual void Show(WebWidget* webwidget, WindowOpenDisposition disposition) = 0 ;
38 58
59 // Used for displaying HTML select elements as popup menus on Mac OS X (other
darin (slow to review) 2009/04/01 18:02:50 as mentioned in the bugs.webkit.org review, this k
60 // platforms will use Show() above). |bounds| represents the positioning on
61 // the screen (in WebKit coordinates, origin at the top left corner) of the
62 // button that will display the menu. It will be used, along with
63 // |item_height| (which refers to the size of each entry in the menu), to
64 // position the menu on the screen. |selected_index| indicates the menu item
65 // that should be drawn as selected when the menu initially is displayed.
66 // |items| contains information about each of the entries in the popup menu,
67 // such as the type (separator, option, group), the text representation and
68 // the item's enabled status.
69 virtual void ShowWithItems(WebWidget* webwidget,
70 const gfx::Rect& bounds,
71 int item_height,
72 int selected_index,
73 const std::vector<MenuItem>& items) = 0;
74
39 // This method is called to instruct the window containing the WebWidget to 75 // This method is called to instruct the window containing the WebWidget to
40 // close. Note: This method should just be the trigger that causes the 76 // close. Note: This method should just be the trigger that causes the
41 // WebWidget to eventually close. It should not actually be destroyed until 77 // WebWidget to eventually close. It should not actually be destroyed until
42 // after this call returns. 78 // after this call returns.
43 virtual void CloseWidgetSoon(WebWidget* webwidget) = 0; 79 virtual void CloseWidgetSoon(WebWidget* webwidget) = 0;
44 80
45 // This method is called to focus the window containing the WebWidget so 81 // This method is called to focus the window containing the WebWidget so
46 // that it receives keyboard events. 82 // that it receives keyboard events.
47 virtual void Focus(WebWidget* webwidget) = 0; 83 virtual void Focus(WebWidget* webwidget) = 0;
48 84
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 virtual void AddRef() = 0; 120 virtual void AddRef() = 0;
85 virtual void Release() = 0; 121 virtual void Release() = 0;
86 122
87 // Returns true if the widget is in a background tab. 123 // Returns true if the widget is in a background tab.
88 virtual bool IsHidden() = 0; 124 virtual bool IsHidden() = 0;
89 125
90 WebWidgetDelegate() { } 126 WebWidgetDelegate() { }
91 virtual ~WebWidgetDelegate() { } 127 virtual ~WebWidgetDelegate() { }
92 128
93 private: 129 private:
94 DISALLOW_EVIL_CONSTRUCTORS(WebWidgetDelegate); 130 DISALLOW_COPY_AND_ASSIGN(WebWidgetDelegate);
95 }; 131 };
96 132
97 #endif // #ifndef WEBKIT_GLUE_WEBWIDGET_DELEGATE_H__ 133 #endif // #ifndef WEBKIT_GLUE_WEBWIDGET_DELEGATE_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698