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 #include <gtk/gtk.h> | |
6 | |
7 #include "webkit/tools/test_shell/webview_host.h" | |
8 | |
9 #include "base/logging.h" | |
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | |
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSettings.h" | |
12 #include "ui/gfx/rect.h" | |
13 #include "ui/gfx/size.h" | |
14 #include "webkit/glue/webpreferences.h" | |
15 #include "webkit/plugins/npapi/gtk_plugin_container.h" | |
16 #include "webkit/tools/test_shell/test_webview_delegate.h" | |
17 | |
18 using WebKit::WebDevToolsAgentClient; | |
19 using WebKit::WebView; | |
20 | |
21 // static | |
22 WebViewHost* WebViewHost::Create(GtkWidget* parent_view, | |
23 TestWebViewDelegate* delegate, | |
24 WebDevToolsAgentClient* dev_tools_client, | |
25 const WebPreferences& prefs) { | |
26 WebViewHost* host = new WebViewHost(); | |
27 | |
28 host->view_ = WebWidgetHost::CreateWidget(parent_view, host); | |
29 host->plugin_container_manager_.set_host_widget(host->view_); | |
30 | |
31 host->webwidget_ = WebView::create(delegate); | |
32 host->webview()->setDevToolsAgentClient(dev_tools_client); | |
33 webkit_glue::ApplyWebPreferences(prefs, host->webview()); | |
34 host->webview()->settings()->setExperimentalCSSGridLayoutEnabled(true); | |
35 host->webview()->initializeMainFrame(delegate); | |
36 host->webwidget_->layout(); | |
37 | |
38 return host; | |
39 } | |
40 | |
41 WebView* WebViewHost::webview() const { | |
42 return static_cast<WebView*>(webwidget_); | |
43 } | |
44 | |
45 void WebViewHost::CreatePluginContainer(gfx::PluginWindowHandle id) { | |
46 plugin_container_manager_.CreatePluginContainer(id); | |
47 } | |
48 | |
49 void WebViewHost::DestroyPluginContainer(gfx::PluginWindowHandle id) { | |
50 plugin_container_manager_.DestroyPluginContainer(id); | |
51 } | |
OLD | NEW |