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" | |
25 #include "webkit/glue/webcursor.h" | 24 #include "webkit/glue/webcursor.h" |
26 #include "webkit/glue/webdropdata.h" | 25 #include "webkit/glue/webdropdata.h" |
27 #include "webkit/glue/webpreferences.h" | 26 #include "webkit/glue/webpreferences.h" |
28 #include "webkit/glue/webkit_glue.h" | 27 #include "webkit/glue/webkit_glue.h" |
29 #include "webkit/glue/plugins/gtk_plugin_container_manager.h" | |
30 #include "webkit/glue/plugins/plugin_list.h" | |
31 #include "webkit/glue/window_open_disposition.h" | 28 #include "webkit/glue/window_open_disposition.h" |
32 #include "webkit/glue/plugins/webplugin_delegate_impl.h" | 29 #include "webkit/plugins/npapi/gtk_plugin_container_manager.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_glue::WebPluginDelegate* TestWebViewDelegate::CreatePluginDelegate( | 200 webkit::npapi::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 WebPluginDelegateImpl::Create(path, mime_type, plugin_parent); | 208 return webkit::npapi::WebPluginDelegateImpl::Create( |
| 209 path, mime_type, plugin_parent); |
209 } | 210 } |
210 | 211 |
211 void TestWebViewDelegate::CreatedPluginWindow( | 212 void TestWebViewDelegate::CreatedPluginWindow( |
212 gfx::PluginWindowHandle id) { | 213 gfx::PluginWindowHandle id) { |
213 shell_->webViewHost()->CreatePluginContainer(id); | 214 shell_->webViewHost()->CreatePluginContainer(id); |
214 } | 215 } |
215 | 216 |
216 void TestWebViewDelegate::WillDestroyPluginWindow( | 217 void TestWebViewDelegate::WillDestroyPluginWindow( |
217 gfx::PluginWindowHandle id) { | 218 gfx::PluginWindowHandle id) { |
218 shell_->webViewHost()->DestroyPluginContainer(id); | 219 shell_->webViewHost()->DestroyPluginContainer(id); |
219 } | 220 } |
220 | 221 |
221 void TestWebViewDelegate::DidMovePlugin( | 222 void TestWebViewDelegate::DidMovePlugin( |
222 const webkit_glue::WebPluginGeometry& move) { | 223 const webkit::npapi::WebPluginGeometry& move) { |
223 WebWidgetHost* host = GetWidgetHost(); | 224 WebWidgetHost* host = GetWidgetHost(); |
224 GtkPluginContainerManager* plugin_container_manager = | 225 webkit::npapi::GtkPluginContainerManager* plugin_container_manager = |
225 static_cast<WebViewHost*>(host)->plugin_container_manager(); | 226 static_cast<WebViewHost*>(host)->plugin_container_manager(); |
226 plugin_container_manager->MovePluginContainer(move); | 227 plugin_container_manager->MovePluginContainer(move); |
227 } | 228 } |
228 | 229 |
229 // Public methods ------------------------------------------------------------- | 230 // Public methods ------------------------------------------------------------- |
230 | 231 |
231 void TestWebViewDelegate::UpdateSelectionClipboard(bool is_empty_selection) { | 232 void TestWebViewDelegate::UpdateSelectionClipboard(bool is_empty_selection) { |
232 if (is_empty_selection) | 233 if (is_empty_selection) |
233 return; | 234 return; |
234 | 235 |
(...skipping 26 matching lines...) Expand all Loading... |
261 } | 262 } |
262 | 263 |
263 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { | 264 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { |
264 gtk_window_set_title(GTK_WINDOW(shell_->mainWnd()), | 265 gtk_window_set_title(GTK_WINDOW(shell_->mainWnd()), |
265 ("Test Shell - " + WideToUTF8(title)).c_str()); | 266 ("Test Shell - " + WideToUTF8(title)).c_str()); |
266 } | 267 } |
267 | 268 |
268 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { | 269 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { |
269 gtk_entry_set_text(GTK_ENTRY(shell_->editWnd()), url.spec().c_str()); | 270 gtk_entry_set_text(GTK_ENTRY(shell_->editWnd()), url.spec().c_str()); |
270 } | 271 } |
OLD | NEW |