OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 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_TOOLS_TEST_SHELL_WEBVIEW_HOST_H_ | |
6 #define WEBKIT_TOOLS_TEST_SHELL_WEBVIEW_HOST_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "ui/gfx/native_widget_types.h" | |
10 #include "ui/gfx/rect.h" | |
11 #include "webkit/tools/test_shell/webwidget_host.h" | |
12 | |
13 #if defined(TOOLKIT_GTK) | |
14 #include "webkit/plugins/npapi/gtk_plugin_container_manager.h" | |
15 #endif | |
16 | |
17 class TestWebViewDelegate; | |
18 struct WebPreferences; | |
19 | |
20 namespace WebKit { | |
21 class WebDevToolsAgentClient; | |
22 class WebView; | |
23 } | |
24 | |
25 // This class is a simple NativeView-based host for a WebView | |
26 class WebViewHost : public WebWidgetHost { | |
27 public: | |
28 // The new instance is deleted once the associated NativeView is destroyed. | |
29 // The newly created window should be resized after it is created, using the | |
30 // MoveWindow (or equivalent) function. | |
31 static WebViewHost* Create(gfx::NativeView parent_view, | |
32 TestWebViewDelegate* delegate, | |
33 WebKit::WebDevToolsAgentClient* devtools_client, | |
34 const WebPreferences& prefs); | |
35 | |
36 WebKit::WebView* webview() const; | |
37 | |
38 #if defined(TOOLKIT_GTK) | |
39 // Create a new plugin parent container for a given plugin XID. | |
40 void CreatePluginContainer(gfx::PluginWindowHandle id); | |
41 | |
42 // Destroy the plugin parent container when a plugin has been destroyed. | |
43 void DestroyPluginContainer(gfx::PluginWindowHandle id); | |
44 | |
45 webkit::npapi::GtkPluginContainerManager* plugin_container_manager() { | |
46 return &plugin_container_manager_; | |
47 } | |
48 #elif defined(OS_MACOSX) | |
49 void SetIsActive(bool active); | |
50 #endif | |
51 | |
52 protected: | |
53 #if defined(OS_WIN) | |
54 virtual bool WndProc(UINT message, WPARAM wparam, LPARAM lparam) { | |
55 return false; | |
56 } | |
57 #endif | |
58 | |
59 #if defined(TOOLKIT_GTK) | |
60 // Helper class that creates and moves plugin containers. | |
61 webkit::npapi::GtkPluginContainerManager plugin_container_manager_; | |
62 #endif | |
63 }; | |
64 | |
65 #endif // WEBKIT_TOOLS_TEST_SHELL_WEBVIEW_HOST_H_ | |
OLD | NEW |