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_TOOLS_TEST_SHELL_WEBVIEW_HOST_H_ | 5 #ifndef WEBKIT_TOOLS_TEST_SHELL_WEBVIEW_HOST_H_ |
6 #define WEBKIT_TOOLS_TEST_SHELL_WEBVIEW_HOST_H_ | 6 #define WEBKIT_TOOLS_TEST_SHELL_WEBVIEW_HOST_H_ |
7 | 7 |
| 8 #include <map> |
| 9 |
8 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
9 #include "base/gfx/native_widget_types.h" | 11 #include "base/gfx/native_widget_types.h" |
10 #include "base/gfx/rect.h" | 12 #include "base/gfx/rect.h" |
11 #include "webkit/tools/test_shell/webwidget_host.h" | 13 #include "webkit/tools/test_shell/webwidget_host.h" |
12 | 14 |
13 struct WebPreferences; | 15 struct WebPreferences; |
14 class WebView; | 16 class WebView; |
15 class WebViewDelegate; | 17 class WebViewDelegate; |
16 | 18 |
| 19 #if defined(OS_LINUX) |
| 20 typedef struct _GtkSocket GtkSocket; |
| 21 #endif |
| 22 |
17 // This class is a simple NativeView-based host for a WebView | 23 // This class is a simple NativeView-based host for a WebView |
18 class WebViewHost : public WebWidgetHost { | 24 class WebViewHost : public WebWidgetHost { |
19 public: | 25 public: |
20 // The new instance is deleted once the associated NativeView is destroyed. | 26 // The new instance is deleted once the associated NativeView is destroyed. |
21 // The newly created window should be resized after it is created, using the | 27 // The newly created window should be resized after it is created, using the |
22 // MoveWindow (or equivalent) function. | 28 // MoveWindow (or equivalent) function. |
23 static WebViewHost* Create(gfx::NativeView parent_view, | 29 static WebViewHost* Create(gfx::NativeView parent_view, |
24 WebViewDelegate* delegate, | 30 WebViewDelegate* delegate, |
25 const WebPreferences& prefs); | 31 const WebPreferences& prefs); |
26 | 32 |
27 WebView* webview() const; | 33 WebView* webview() const; |
28 | 34 |
| 35 #if defined(OS_LINUX) |
| 36 // Create a new plugin parent container, returning its X window id for |
| 37 // embedders to use. |
| 38 GdkNativeWindow CreatePluginContainer(); |
| 39 |
| 40 // Map a GdkNativeWindow returned by CreatePluginContainer() back to |
| 41 // the GtkWidget hosting it. Used when we get a message back from the |
| 42 // renderer indicating a plugin needs to move. |
| 43 GtkWidget* MapIDToWidget(GdkNativeWindow id); |
| 44 #endif |
| 45 |
29 protected: | 46 protected: |
30 #if defined(OS_WIN) | 47 #if defined(OS_WIN) |
31 virtual bool WndProc(UINT message, WPARAM wparam, LPARAM lparam) { | 48 virtual bool WndProc(UINT message, WPARAM wparam, LPARAM lparam) { |
32 return false; | 49 return false; |
33 } | 50 } |
34 #endif | 51 #endif |
| 52 |
| 53 #if defined(OS_LINUX) |
| 54 // A map used for MapIDToWidget() above. |
| 55 typedef std::map<GdkNativeWindow, GtkWidget*> NativeWindowToWidgetMap; |
| 56 NativeWindowToWidgetMap native_window_to_widget_map_; |
| 57 |
| 58 // Callback for when one of our plugins goes away. |
| 59 static gboolean OnPlugRemovedThunk(GtkSocket* socket, |
| 60 WebViewHost* web_view_host) { |
| 61 return web_view_host->OnPlugRemoved(socket); |
| 62 } |
| 63 gboolean OnPlugRemoved(GtkSocket* socket); |
| 64 #endif |
35 }; | 65 }; |
36 | 66 |
37 #endif // WEBKIT_TOOLS_TEST_SHELL_WEBVIEW_HOST_H_ | 67 #endif // WEBKIT_TOOLS_TEST_SHELL_WEBVIEW_HOST_H_ |
OLD | NEW |