| OLD | NEW |
| 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 // 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 | 10 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 const std::string& mtype = | 91 const std::string& mtype = |
| 92 (actual_mime_type && !actual_mime_type->empty()) ? *actual_mime_type | 92 (actual_mime_type && !actual_mime_type->empty()) ? *actual_mime_type |
| 93 : mime_type; | 93 : mime_type; |
| 94 | 94 |
| 95 GdkNativeWindow plugin_parent = | 95 GdkNativeWindow plugin_parent = |
| 96 shell_->webViewHost()->CreatePluginContainer(); | 96 shell_->webViewHost()->CreatePluginContainer(); |
| 97 | 97 |
| 98 return WebPluginDelegateImpl::Create(info.path, mtype, plugin_parent); | 98 return WebPluginDelegateImpl::Create(info.path, mtype, plugin_parent); |
| 99 } | 99 } |
| 100 | 100 |
| 101 void TestWebViewDelegate::WillDestroyPluginWindow(unsigned long id) { |
| 102 shell_->webViewHost()->OnPluginWindowDestroyed(id); |
| 103 } |
| 104 |
| 101 void TestWebViewDelegate::ShowJavaScriptAlert(const std::wstring& message) { | 105 void TestWebViewDelegate::ShowJavaScriptAlert(const std::wstring& message) { |
| 102 GtkWidget* dialog = gtk_message_dialog_new( | 106 GtkWidget* dialog = gtk_message_dialog_new( |
| 103 shell_->mainWnd(), GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, | 107 shell_->mainWnd(), GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, |
| 104 GTK_BUTTONS_OK, "%s", WideToUTF8(message).c_str()); | 108 GTK_BUTTONS_OK, "%s", WideToUTF8(message).c_str()); |
| 105 gtk_window_set_title(GTK_WINDOW(dialog), "JavaScript Alert"); | 109 gtk_window_set_title(GTK_WINDOW(dialog), "JavaScript Alert"); |
| 106 gtk_dialog_run(GTK_DIALOG(dialog)); // Runs a nested message loop. | 110 gtk_dialog_run(GTK_DIALOG(dialog)); // Runs a nested message loop. |
| 107 gtk_widget_destroy(dialog); | 111 gtk_widget_destroy(dialog); |
| 108 } | 112 } |
| 109 | 113 |
| 110 void TestWebViewDelegate::Show(WebWidget* webwidget, | 114 void TestWebViewDelegate::Show(WebWidget* webwidget, |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 // Private methods ----------------------------------------------------------- | 308 // Private methods ----------------------------------------------------------- |
| 305 | 309 |
| 306 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { | 310 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { |
| 307 gtk_window_set_title(GTK_WINDOW(shell_->mainWnd()), | 311 gtk_window_set_title(GTK_WINDOW(shell_->mainWnd()), |
| 308 ("Test Shell - " + WideToUTF8(title)).c_str()); | 312 ("Test Shell - " + WideToUTF8(title)).c_str()); |
| 309 } | 313 } |
| 310 | 314 |
| 311 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { | 315 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { |
| 312 gtk_entry_set_text(GTK_ENTRY(shell_->editWnd()), url.spec().c_str()); | 316 gtk_entry_set_text(GTK_ENTRY(shell_->editWnd()), url.spec().c_str()); |
| 313 } | 317 } |
| OLD | NEW |