| 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> |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 return WebRect(); | 194 return WebRect(); |
| 195 } | 195 } |
| 196 | 196 |
| 197 void TestWebViewDelegate::runModal() { | 197 void TestWebViewDelegate::runModal() { |
| 198 NOTIMPLEMENTED(); | 198 NOTIMPLEMENTED(); |
| 199 } | 199 } |
| 200 | 200 |
| 201 // WebPluginPageDelegate ------------------------------------------------------ | 201 // WebPluginPageDelegate ------------------------------------------------------ |
| 202 | 202 |
| 203 webkit_glue::WebPluginDelegate* TestWebViewDelegate::CreatePluginDelegate( | 203 webkit_glue::WebPluginDelegate* TestWebViewDelegate::CreatePluginDelegate( |
| 204 const GURL& url, | 204 const FilePath& path, |
| 205 const std::string& mime_type, | 205 const std::string& mime_type) { |
| 206 std::string* actual_mime_type) { | |
| 207 bool allow_wildcard = true; | |
| 208 WebPluginInfo info; | |
| 209 if (!NPAPI::PluginList::Singleton()->GetPluginInfo( | |
| 210 url, mime_type, allow_wildcard, &info, actual_mime_type)) { | |
| 211 return NULL; | |
| 212 } | |
| 213 | |
| 214 const std::string& mtype = | |
| 215 (actual_mime_type && !actual_mime_type->empty()) ? *actual_mime_type | |
| 216 : mime_type; | |
| 217 // TODO(evanm): we probably shouldn't be doing this mapping to X ids at | 206 // TODO(evanm): we probably shouldn't be doing this mapping to X ids at |
| 218 // this level. | 207 // this level. |
| 219 GdkNativeWindow plugin_parent = | 208 GdkNativeWindow plugin_parent = |
| 220 GDK_WINDOW_XWINDOW(shell_->webViewHost()->view_handle()->window); | 209 GDK_WINDOW_XWINDOW(shell_->webViewHost()->view_handle()->window); |
| 221 | 210 |
| 222 return WebPluginDelegateImpl::Create(info.path, mtype, plugin_parent); | 211 return WebPluginDelegateImpl::Create(path, mime_type, plugin_parent); |
| 223 } | 212 } |
| 224 | 213 |
| 225 void TestWebViewDelegate::CreatedPluginWindow( | 214 void TestWebViewDelegate::CreatedPluginWindow( |
| 226 gfx::PluginWindowHandle id) { | 215 gfx::PluginWindowHandle id) { |
| 227 shell_->webViewHost()->CreatePluginContainer(id); | 216 shell_->webViewHost()->CreatePluginContainer(id); |
| 228 } | 217 } |
| 229 | 218 |
| 230 void TestWebViewDelegate::WillDestroyPluginWindow( | 219 void TestWebViewDelegate::WillDestroyPluginWindow( |
| 231 gfx::PluginWindowHandle id) { | 220 gfx::PluginWindowHandle id) { |
| 232 shell_->webViewHost()->DestroyPluginContainer(id); | 221 shell_->webViewHost()->DestroyPluginContainer(id); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 } | 264 } |
| 276 | 265 |
| 277 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { | 266 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { |
| 278 gtk_window_set_title(GTK_WINDOW(shell_->mainWnd()), | 267 gtk_window_set_title(GTK_WINDOW(shell_->mainWnd()), |
| 279 ("Test Shell - " + WideToUTF8(title)).c_str()); | 268 ("Test Shell - " + WideToUTF8(title)).c_str()); |
| 280 } | 269 } |
| 281 | 270 |
| 282 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { | 271 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { |
| 283 gtk_entry_set_text(GTK_ENTRY(shell_->editWnd()), url.spec().c_str()); | 272 gtk_entry_set_text(GTK_ENTRY(shell_->editWnd()), url.spec().c_str()); |
| 284 } | 273 } |
| OLD | NEW |