OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // This file was forked off the Mac port. | 5 // This file was forked off the Mac port. |
6 | 6 |
7 #include "webkit/tools/test_shell/test_webview_delegate.h" | 7 #include "webkit/tools/test_shell/test_webview_delegate.h" |
8 | 8 |
9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
10 #include <gdk/gdkx.h> | 10 #include <gdk/gdkx.h> |
11 | 11 |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
15 #include "chrome/common/page_transition_types.h" | 15 #include "chrome/common/page_transition_types.h" |
16 #include "gfx/gtk_util.h" | 16 #include "gfx/gtk_util.h" |
17 #include "gfx/point.h" | 17 #include "gfx/point.h" |
18 #include "third_party/WebKit/WebKit/chromium/public/WebCString.h" | 18 #include "third_party/WebKit/WebKit/chromium/public/WebCString.h" |
19 #include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h" | 19 #include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h" |
20 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" | 20 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" |
21 #include "third_party/WebKit/WebKit/chromium/public/WebRect.h" | 21 #include "third_party/WebKit/WebKit/chromium/public/WebRect.h" |
22 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" | 22 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" |
23 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" | 23 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" |
| 24 #include "webkit/glue/plugins/webplugin.h" |
24 #include "webkit/glue/webcursor.h" | 25 #include "webkit/glue/webcursor.h" |
25 #include "webkit/glue/webdropdata.h" | 26 #include "webkit/glue/webdropdata.h" |
26 #include "webkit/glue/webpreferences.h" | 27 #include "webkit/glue/webpreferences.h" |
27 #include "webkit/glue/webkit_glue.h" | 28 #include "webkit/glue/webkit_glue.h" |
| 29 #include "webkit/glue/plugins/gtk_plugin_container_manager.h" |
| 30 #include "webkit/glue/plugins/plugin_list.h" |
28 #include "webkit/glue/window_open_disposition.h" | 31 #include "webkit/glue/window_open_disposition.h" |
29 #include "webkit/plugins/npapi/gtk_plugin_container_manager.h" | 32 #include "webkit/glue/plugins/webplugin_delegate_impl.h" |
30 #include "webkit/plugins/npapi/plugin_list.h" | |
31 #include "webkit/plugins/npapi/webplugin.h" | |
32 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" | |
33 #include "webkit/tools/test_shell/test_navigation_controller.h" | 33 #include "webkit/tools/test_shell/test_navigation_controller.h" |
34 #include "webkit/tools/test_shell/test_shell.h" | 34 #include "webkit/tools/test_shell/test_shell.h" |
35 | 35 |
36 using WebKit::WebCursorInfo; | 36 using WebKit::WebCursorInfo; |
37 using WebKit::WebFrame; | 37 using WebKit::WebFrame; |
38 using WebKit::WebNavigationPolicy; | 38 using WebKit::WebNavigationPolicy; |
39 using WebKit::WebPopupMenuInfo; | 39 using WebKit::WebPopupMenuInfo; |
40 using WebKit::WebRect; | 40 using WebKit::WebRect; |
41 using WebKit::WebWidget; | 41 using WebKit::WebWidget; |
42 using WebKit::WebView; | 42 using WebKit::WebView; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 // Not necessary on Linux. | 190 // Not necessary on Linux. |
191 return WebRect(); | 191 return WebRect(); |
192 } | 192 } |
193 | 193 |
194 void TestWebViewDelegate::runModal() { | 194 void TestWebViewDelegate::runModal() { |
195 NOTIMPLEMENTED(); | 195 NOTIMPLEMENTED(); |
196 } | 196 } |
197 | 197 |
198 // WebPluginPageDelegate ------------------------------------------------------ | 198 // WebPluginPageDelegate ------------------------------------------------------ |
199 | 199 |
200 webkit::npapi::WebPluginDelegate* TestWebViewDelegate::CreatePluginDelegate( | 200 webkit_glue::WebPluginDelegate* TestWebViewDelegate::CreatePluginDelegate( |
201 const FilePath& path, | 201 const FilePath& path, |
202 const std::string& mime_type) { | 202 const std::string& mime_type) { |
203 // TODO(evanm): we probably shouldn't be doing this mapping to X ids at | 203 // TODO(evanm): we probably shouldn't be doing this mapping to X ids at |
204 // this level. | 204 // this level. |
205 GdkNativeWindow plugin_parent = | 205 GdkNativeWindow plugin_parent = |
206 GDK_WINDOW_XWINDOW(shell_->webViewHost()->view_handle()->window); | 206 GDK_WINDOW_XWINDOW(shell_->webViewHost()->view_handle()->window); |
207 | 207 |
208 return webkit::npapi::WebPluginDelegateImpl::Create( | 208 return WebPluginDelegateImpl::Create(path, mime_type, plugin_parent); |
209 path, mime_type, plugin_parent); | |
210 } | 209 } |
211 | 210 |
212 void TestWebViewDelegate::CreatedPluginWindow( | 211 void TestWebViewDelegate::CreatedPluginWindow( |
213 gfx::PluginWindowHandle id) { | 212 gfx::PluginWindowHandle id) { |
214 shell_->webViewHost()->CreatePluginContainer(id); | 213 shell_->webViewHost()->CreatePluginContainer(id); |
215 } | 214 } |
216 | 215 |
217 void TestWebViewDelegate::WillDestroyPluginWindow( | 216 void TestWebViewDelegate::WillDestroyPluginWindow( |
218 gfx::PluginWindowHandle id) { | 217 gfx::PluginWindowHandle id) { |
219 shell_->webViewHost()->DestroyPluginContainer(id); | 218 shell_->webViewHost()->DestroyPluginContainer(id); |
220 } | 219 } |
221 | 220 |
222 void TestWebViewDelegate::DidMovePlugin( | 221 void TestWebViewDelegate::DidMovePlugin( |
223 const webkit::npapi::WebPluginGeometry& move) { | 222 const webkit_glue::WebPluginGeometry& move) { |
224 WebWidgetHost* host = GetWidgetHost(); | 223 WebWidgetHost* host = GetWidgetHost(); |
225 webkit::npapi::GtkPluginContainerManager* plugin_container_manager = | 224 GtkPluginContainerManager* plugin_container_manager = |
226 static_cast<WebViewHost*>(host)->plugin_container_manager(); | 225 static_cast<WebViewHost*>(host)->plugin_container_manager(); |
227 plugin_container_manager->MovePluginContainer(move); | 226 plugin_container_manager->MovePluginContainer(move); |
228 } | 227 } |
229 | 228 |
230 // Public methods ------------------------------------------------------------- | 229 // Public methods ------------------------------------------------------------- |
231 | 230 |
232 void TestWebViewDelegate::UpdateSelectionClipboard(bool is_empty_selection) { | 231 void TestWebViewDelegate::UpdateSelectionClipboard(bool is_empty_selection) { |
233 if (is_empty_selection) | 232 if (is_empty_selection) |
234 return; | 233 return; |
235 | 234 |
(...skipping 26 matching lines...) Expand all Loading... |
262 } | 261 } |
263 | 262 |
264 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { | 263 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { |
265 gtk_window_set_title(GTK_WINDOW(shell_->mainWnd()), | 264 gtk_window_set_title(GTK_WINDOW(shell_->mainWnd()), |
266 ("Test Shell - " + WideToUTF8(title)).c_str()); | 265 ("Test Shell - " + WideToUTF8(title)).c_str()); |
267 } | 266 } |
268 | 267 |
269 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { | 268 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { |
270 gtk_entry_set_text(GTK_ENTRY(shell_->editWnd()), url.spec().c_str()); | 269 gtk_entry_set_text(GTK_ENTRY(shell_->editWnd()), url.spec().c_str()); |
271 } | 270 } |
OLD | NEW |