| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-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 #include "webkit/tools/test_shell/test_shell.h" | 5 #include "webkit/tools/test_shell/test_shell.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <fontconfig/fontconfig.h> | 9 #include <fontconfig/fontconfig.h> |
| 10 #include <gtk/gtk.h> | 10 #include <gtk/gtk.h> |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "net/base/net_util.h" | 25 #include "net/base/net_util.h" |
| 26 #include "webkit/glue/plugins/plugin_list.h" | 26 #include "webkit/glue/plugins/plugin_list.h" |
| 27 #include "webkit/glue/resource_loader_bridge.h" | 27 #include "webkit/glue/resource_loader_bridge.h" |
| 28 #include "webkit/glue/webframe.h" | 28 #include "webkit/glue/webframe.h" |
| 29 #include "webkit/glue/webkit_glue.h" | 29 #include "webkit/glue/webkit_glue.h" |
| 30 #include "webkit/glue/webpreferences.h" | 30 #include "webkit/glue/webpreferences.h" |
| 31 #include "webkit/glue/webview.h" | 31 #include "webkit/glue/webview.h" |
| 32 #include "webkit/tools/test_shell/test_navigation_controller.h" | 32 #include "webkit/tools/test_shell/test_navigation_controller.h" |
| 33 #include "webkit/tools/test_shell/test_webview_delegate.h" | 33 #include "webkit/tools/test_shell/test_webview_delegate.h" |
| 34 | 34 |
| 35 using WebKit::WebWidget; |
| 36 |
| 35 namespace { | 37 namespace { |
| 36 | 38 |
| 37 // Convert a FilePath into an FcChar* (used by fontconfig). | 39 // Convert a FilePath into an FcChar* (used by fontconfig). |
| 38 // The pointer only lives for the duration for the expression. | 40 // The pointer only lives for the duration for the expression. |
| 39 const FcChar8* FilePathAsFcChar(const FilePath& path) { | 41 const FcChar8* FilePathAsFcChar(const FilePath& path) { |
| 40 return reinterpret_cast<const FcChar8*>(path.value().c_str()); | 42 return reinterpret_cast<const FcChar8*>(path.value().c_str()); |
| 41 } | 43 } |
| 42 | 44 |
| 43 // Data resources on linux. This is a pointer to the mmapped resources file. | 45 // Data resources on linux. This is a pointer to the mmapped resources file. |
| 44 static base::DataPack* g_resource_data_pack = NULL; | 46 static base::DataPack* g_resource_data_pack = NULL; |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 } | 462 } |
| 461 | 463 |
| 462 void TestShell::DestroyWindow(gfx::NativeWindow windowHandle) { | 464 void TestShell::DestroyWindow(gfx::NativeWindow windowHandle) { |
| 463 RemoveWindowFromList(windowHandle); | 465 RemoveWindowFromList(windowHandle); |
| 464 gtk_widget_destroy(GTK_WIDGET(windowHandle)); | 466 gtk_widget_destroy(GTK_WIDGET(windowHandle)); |
| 465 } | 467 } |
| 466 | 468 |
| 467 WebWidget* TestShell::CreatePopupWidget(WebView* webview) { | 469 WebWidget* TestShell::CreatePopupWidget(WebView* webview) { |
| 468 GtkWidget* popupwindow = gtk_window_new(GTK_WINDOW_POPUP); | 470 GtkWidget* popupwindow = gtk_window_new(GTK_WINDOW_POPUP); |
| 469 GtkWidget* vbox = gtk_vbox_new(FALSE, 0); | 471 GtkWidget* vbox = gtk_vbox_new(FALSE, 0); |
| 470 WebWidgetHost* host = WebWidgetHost::Create(vbox, delegate_); | 472 WebWidgetHost* host = WebWidgetHost::Create(vbox, popup_delegate_); |
| 471 gtk_container_add(GTK_CONTAINER(popupwindow), vbox); | 473 gtk_container_add(GTK_CONTAINER(popupwindow), vbox); |
| 472 m_popupHost = host; | 474 m_popupHost = host; |
| 473 | 475 |
| 474 // Grab all input to the test shell and funnel it to the popup. | 476 // Grab all input to the test shell and funnel it to the popup. |
| 475 // The popup will detect if mouseclicks are outside its bounds and destroy | 477 // The popup will detect if mouseclicks are outside its bounds and destroy |
| 476 // itself if so. Clicks that are outside the test_shell window will destroy | 478 // itself if so. Clicks that are outside the test_shell window will destroy |
| 477 // the popup by taking focus away from the main window. | 479 // the popup by taking focus away from the main window. |
| 478 gtk_grab_add(host->view_handle()); | 480 gtk_grab_add(host->view_handle()); |
| 479 | 481 |
| 480 return host->webwidget(); | 482 return host->webwidget(); |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 break; | 685 break; |
| 684 } | 686 } |
| 685 return TestShell::NetResourceProvider(resource_id); | 687 return TestShell::NetResourceProvider(resource_id); |
| 686 } | 688 } |
| 687 | 689 |
| 688 bool GetPlugins(bool refresh, std::vector<WebPluginInfo>* plugins) { | 690 bool GetPlugins(bool refresh, std::vector<WebPluginInfo>* plugins) { |
| 689 return NPAPI::PluginList::Singleton()->GetPlugins(refresh, plugins); | 691 return NPAPI::PluginList::Singleton()->GetPlugins(refresh, plugins); |
| 690 } | 692 } |
| 691 | 693 |
| 692 } // namespace webkit_glue | 694 } // namespace webkit_glue |
| OLD | NEW |