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