Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: webkit/tools/test_shell/test_webview_delegate_gtk.cc

Issue 19413: Linux plugins WIP. (Closed)
Patch Set: review comments Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webkit/glue/webplugin_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #include "base/gfx/point.h" 11 #include "base/gfx/point.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "base/string_util.h" 13 #include "base/string_util.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 "webkit/glue/webcursor.h" 16 #include "webkit/glue/webcursor.h"
17 #include "webkit/glue/webdatasource.h" 17 #include "webkit/glue/webdatasource.h"
18 #include "webkit/glue/webdropdata.h" 18 #include "webkit/glue/webdropdata.h"
19 #include "webkit/glue/weberror.h" 19 #include "webkit/glue/weberror.h"
20 #include "webkit/glue/webframe.h" 20 #include "webkit/glue/webframe.h"
21 #include "webkit/glue/webpreferences.h" 21 #include "webkit/glue/webpreferences.h"
22 #include "webkit/glue/weburlrequest.h" 22 #include "webkit/glue/weburlrequest.h"
23 #include "webkit/glue/webkit_glue.h" 23 #include "webkit/glue/webkit_glue.h"
24 #include "webkit/glue/webview.h" 24 #include "webkit/glue/webview.h"
25 #include "webkit/glue/plugins/plugin_list.h"
25 #include "webkit/glue/window_open_disposition.h" 26 #include "webkit/glue/window_open_disposition.h"
27 #include "webkit/glue/plugins/webplugin_delegate_impl.h"
26 #include "webkit/tools/test_shell/test_navigation_controller.h" 28 #include "webkit/tools/test_shell/test_navigation_controller.h"
27 #include "webkit/tools/test_shell/test_shell.h" 29 #include "webkit/tools/test_shell/test_shell.h"
28 30
29 namespace { 31 namespace {
30 32
31 33
32 enum SelectionClipboardType { 34 enum SelectionClipboardType {
33 TEXT_HTML, 35 TEXT_HTML,
34 PLAIN_TEXT, 36 PLAIN_TEXT,
35 }; 37 };
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 72
71 TestWebViewDelegate::~TestWebViewDelegate() { 73 TestWebViewDelegate::~TestWebViewDelegate() {
72 } 74 }
73 75
74 WebPluginDelegate* TestWebViewDelegate::CreatePluginDelegate( 76 WebPluginDelegate* TestWebViewDelegate::CreatePluginDelegate(
75 WebView* webview, 77 WebView* webview,
76 const GURL& url, 78 const GURL& url,
77 const std::string& mime_type, 79 const std::string& mime_type,
78 const std::string& clsid, 80 const std::string& clsid,
79 std::string* actual_mime_type) { 81 std::string* actual_mime_type) {
80 NOTIMPLEMENTED(); 82 bool allow_wildcard = true;
81 return NULL; 83 WebPluginInfo info;
84 if (!NPAPI::PluginList::Singleton()->GetPluginInfo(url, mime_type, clsid,
85 allow_wildcard, &info,
86 actual_mime_type))
87 return NULL;
88
89 if (actual_mime_type && !actual_mime_type->empty())
90 return WebPluginDelegateImpl::Create(info.path, *actual_mime_type,
91 shell_->webViewHost()->view_handle());
92 else
93 return WebPluginDelegateImpl::Create(info.path, mime_type,
94 shell_->webViewHost()->view_handle());
82 } 95 }
83 96
84 void TestWebViewDelegate::ShowJavaScriptAlert(const std::wstring& message) { 97 void TestWebViewDelegate::ShowJavaScriptAlert(const std::wstring& message) {
85 // TODO(port): remove GTK_WINDOW bit after gfx::NativeWindow is fixed. 98 // TODO(port): remove GTK_WINDOW bit after gfx::NativeWindow is fixed.
86 GtkWidget* dialog = gtk_message_dialog_new( 99 GtkWidget* dialog = gtk_message_dialog_new(
87 GTK_WINDOW(shell_->mainWnd()), GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, 100 GTK_WINDOW(shell_->mainWnd()), GTK_DIALOG_MODAL, GTK_MESSAGE_INFO,
88 GTK_BUTTONS_OK, "%s", WideToUTF8(message).c_str()); 101 GTK_BUTTONS_OK, "%s", WideToUTF8(message).c_str());
89 gtk_window_set_title(GTK_WINDOW(dialog), "JavaScript Alert"); 102 gtk_window_set_title(GTK_WINDOW(dialog), "JavaScript Alert");
90 gtk_dialog_run(GTK_DIALOG(dialog)); // Runs a nested message loop. 103 gtk_dialog_run(GTK_DIALOG(dialog)); // Runs a nested message loop.
91 gtk_widget_destroy(dialog); 104 gtk_widget_destroy(dialog);
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 // Private methods ----------------------------------------------------------- 227 // Private methods -----------------------------------------------------------
215 228
216 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { 229 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) {
217 gtk_window_set_title(GTK_WINDOW(shell_->mainWnd()), 230 gtk_window_set_title(GTK_WINDOW(shell_->mainWnd()),
218 ("Test Shell - " + WideToUTF8(title)).c_str()); 231 ("Test Shell - " + WideToUTF8(title)).c_str());
219 } 232 }
220 233
221 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { 234 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) {
222 gtk_entry_set_text(GTK_ENTRY(shell_->editWnd()), url.spec().c_str()); 235 gtk_entry_set_text(GTK_ENTRY(shell_->editWnd()), url.spec().c_str());
223 } 236 }
OLDNEW
« no previous file with comments | « webkit/glue/webplugin_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698