| 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 #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 "base/gfx/rect.h" | 10 #include "base/gfx/rect.h" |
| 11 #include "base/gfx/size.h" | 11 #include "base/gfx/size.h" |
| 12 #include "skia/ext/platform_canvas.h" | 12 #include "skia/ext/platform_canvas.h" |
| 13 #include "webkit/api/public/WebView.h" |
| 13 #include "webkit/glue/plugins/gtk_plugin_container.h" | 14 #include "webkit/glue/plugins/gtk_plugin_container.h" |
| 14 #include "webkit/glue/webpreferences.h" | 15 #include "webkit/glue/webpreferences.h" |
| 15 #include "webkit/glue/webview.h" | |
| 16 #include "webkit/tools/test_shell/test_webview_delegate.h" | 16 #include "webkit/tools/test_shell/test_webview_delegate.h" |
| 17 | 17 |
| 18 using WebKit::WebView; |
| 19 |
| 18 // static | 20 // static |
| 19 WebViewHost* WebViewHost::Create(GtkWidget* parent_view, | 21 WebViewHost* WebViewHost::Create(GtkWidget* parent_view, |
| 20 TestWebViewDelegate* delegate, | 22 TestWebViewDelegate* delegate, |
| 21 const WebPreferences& prefs) { | 23 const WebPreferences& prefs) { |
| 22 WebViewHost* host = new WebViewHost(); | 24 WebViewHost* host = new WebViewHost(); |
| 23 | 25 |
| 24 host->view_ = WebWidgetHost::CreateWidget(parent_view, host); | 26 host->view_ = WebWidgetHost::CreateWidget(parent_view, host); |
| 25 host->plugin_container_manager_.set_host_widget(host->view_); | 27 host->plugin_container_manager_.set_host_widget(host->view_); |
| 26 | 28 |
| 27 host->webwidget_ = WebView::Create(delegate); | 29 host->webwidget_ = WebView::create(delegate); |
| 28 prefs.Apply(host->webview()); | 30 prefs.Apply(host->webview()); |
| 29 host->webview()->initializeMainFrame(delegate); | 31 host->webview()->initializeMainFrame(delegate); |
| 30 host->webwidget_->layout(); | 32 host->webwidget_->layout(); |
| 31 | 33 |
| 32 return host; | 34 return host; |
| 33 } | 35 } |
| 34 | 36 |
| 35 WebView* WebViewHost::webview() const { | 37 WebView* WebViewHost::webview() const { |
| 36 return static_cast<WebView*>(webwidget_); | 38 return static_cast<WebView*>(webwidget_); |
| 37 } | 39 } |
| 38 | 40 |
| 39 void WebViewHost::CreatePluginContainer(gfx::PluginWindowHandle id) { | 41 void WebViewHost::CreatePluginContainer(gfx::PluginWindowHandle id) { |
| 40 plugin_container_manager_.CreatePluginContainer(id); | 42 plugin_container_manager_.CreatePluginContainer(id); |
| 41 } | 43 } |
| 42 | 44 |
| 43 void WebViewHost::DestroyPluginContainer(gfx::PluginWindowHandle id) { | 45 void WebViewHost::DestroyPluginContainer(gfx::PluginWindowHandle id) { |
| 44 plugin_container_manager_.DestroyPluginContainer(id); | 46 plugin_container_manager_.DestroyPluginContainer(id); |
| 45 } | 47 } |
| OLD | NEW |