Changeset 96383 in webkit
- Timestamp:
- Sep 29, 2011 7:30:15 PM (13 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r96345 r96383 1 2011-09-29 Ravi Phaneendra Kasibhatla <ravi.kasibhatla@motorola.com> 2 3 Initial implementation of WebInspector for WebKit2 GTK port. 4 https://bugs.webkit.org/show_bug.cgi?id=68235 5 6 Reviewed by Martin Robinson. 7 8 * UIProcess/WebInspectorProxy.cpp: 9 (WebKit::WebInspectorProxy::WebInspectorProxy): Initialize the native window handles of GTK. 10 * UIProcess/WebInspectorProxy.h: Add native window handle for inspector window. 11 * UIProcess/gtk/WebInspectorGtk.cpp: 12 (WebKit::inspectorFilesBasePath): Base folder for inspector resources. 13 (WebKit::inspectorWindowDestroyed): Invoked when inspector window is closed by user. 14 (WebKit::WebInspectorProxy::windowDestroyed): Resets the native handles to 0 when user closes the window. 15 (WebKit::WebInspectorProxy::platformCreateInspectorPage): Create the WebView for inspector. 16 (WebKit::WebInspectorProxy::platformOpen): Create the window for inspector. 17 (WebKit::WebInspectorProxy::platformDidClose): Close both WebView & window of inspector. 18 (WebKit::WebInspectorProxy::platformInspectedURLChanged): Update the title of inspector window. 19 (WebKit::WebInspectorProxy::inspectorPageURL): Return the absolute URL of inspector.html. 20 (WebKit::WebInspectorProxy::inspectorBaseURL): Return the location where inspector resources are present. 21 WebProcess is given read access to this folder only for loading file URLs by sandboxed extension. 22 1 23 2011-09-23 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> 2 24 -
trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp
r96014 r96383 1 1 /* 2 2 * Copyright (C) 2010 Apple Inc. All rights reserved. 3 * Portions Copyright (c) 2011 Motorola Mobility, Inc. All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 30 31 31 32 #include "WebInspectorMessages.h" 33 #include "WebPageCreationParameters.h" 34 #include "WebPageGroup.h" 32 35 #include "WebPageProxy.h" 33 #include "WebPageCreationParameters.h"34 36 #include "WebPreferences.h" 35 37 #include "WebProcessProxy.h" 36 #include "WebPageGroup.h"37 38 38 39 #if PLATFORM(WIN) 39 40 #include "WebView.h" 40 41 #endif 41 42 #include <WebCore/NotImplemented.h>43 42 44 43 using namespace WebCore; … … 73 72 #if PLATFORM(WIN) 74 73 , m_inspectorWindow(0) 74 #elif PLATFORM(GTK) 75 , m_inspectorView(0) 76 , m_inspectorWindow(0) 75 77 #endif 76 78 { -
trunk/Source/WebKit2/UIProcess/WebInspectorProxy.h
r96014 r96383 1 1 /* 2 2 * Copyright (C) 2010 Apple Inc. All rights reserved. 3 * Portions Copyright (c) 2011 Motorola Mobility, Inc. All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 83 84 #if PLATFORM(MAC) 84 85 void inspectedViewFrameDidChange(); 86 #elif PLATFORM(GTK) 87 void windowDestroyed(); 85 88 #endif 86 89 … … 176 179 HWND m_inspectorWindow; 177 180 RefPtr<WebView> m_inspectorView; 181 #elif PLATFORM(GTK) 182 GtkWidget* m_inspectorView; 183 GtkWidget* m_inspectorWindow; 178 184 #endif 179 185 }; -
trunk/Source/WebKit2/UIProcess/gtk/WebInspectorGtk.cpp
r96014 r96383 30 30 #if ENABLE(INSPECTOR) 31 31 32 #include "WebKitWebViewBasePrivate.h" 33 #include "WebProcessProxy.h" 34 35 #include <WebCore/FileSystem.h> 32 36 #include <WebCore/NotImplemented.h> 37 #include <glib/gi18n-lib.h> 38 #include <gtk/gtk.h> 39 #include <wtf/gobject/GOwnPtr.h> 40 #include <wtf/text/CString.h> 33 41 #include <wtf/text/WTFString.h> 34 42 35 43 namespace WebKit { 36 44 45 static const char* inspectorFilesBasePath() 46 { 47 const gchar* environmentPath = g_getenv("WEBKIT_INSPECTOR_PATH"); 48 if (environmentPath && g_file_test(environmentPath, G_FILE_TEST_IS_DIR)) 49 return environmentPath; 50 51 static const char* inspectorFilesPath = DATA_DIR""G_DIR_SEPARATOR_S 52 "webkitgtk-"WEBKITGTK_API_VERSION_STRING""G_DIR_SEPARATOR_S 53 "webinspector"G_DIR_SEPARATOR_S; 54 return inspectorFilesPath; 55 } 56 57 static gboolean inspectorWindowDestroyed(GtkWidget* window, GdkEvent*, gpointer userData) 58 { 59 WebInspectorProxy* inspectorProxy = static_cast<WebInspectorProxy*>(userData); 60 61 // Inform WebProcess about webinspector closure. Not doing so, 62 // results in failure of subsequent invocation of webinspector. 63 inspectorProxy->close(); 64 inspectorProxy->windowDestroyed(); 65 66 return FALSE; 67 } 68 69 void WebInspectorProxy::windowDestroyed() 70 { 71 ASSERT(m_inspectorView); 72 ASSERT(m_inspectorWindow); 73 m_inspectorView = 0; 74 m_inspectorWindow = 0; 75 } 76 37 77 WebPageProxy* WebInspectorProxy::platformCreateInspectorPage() 38 78 { 39 notImplemented(); 40 return 0; 79 ASSERT(m_page); 80 ASSERT(!m_inspectorView); 81 m_inspectorView = GTK_WIDGET(webkitWebViewBaseCreate(page()->process()->context(), inspectorPageGroup())); 82 return webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(m_inspectorView)); 41 83 } 42 84 43 85 void WebInspectorProxy::platformOpen() 44 86 { 45 notImplemented(); 87 ASSERT(!m_inspectorWindow); 88 m_inspectorWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL); 89 90 gtk_window_set_title(GTK_WINDOW(m_inspectorWindow), _("Web Inspector")); 91 gtk_window_set_default_size(GTK_WINDOW(m_inspectorWindow), initialWindowWidth, initialWindowHeight); 92 g_signal_connect(m_inspectorWindow, "delete-event", G_CALLBACK(inspectorWindowDestroyed), this); 93 94 gtk_container_add(GTK_CONTAINER(m_inspectorWindow), m_inspectorView); 95 gtk_widget_show(m_inspectorView); 96 gtk_widget_show(m_inspectorWindow); 46 97 } 47 98 48 99 void WebInspectorProxy::platformDidClose() 49 100 { 50 notImplemented(); 101 if (m_inspectorWindow) { 102 gtk_widget_destroy(m_inspectorWindow); 103 m_inspectorWindow = 0; 104 m_inspectorView = 0; 105 } 51 106 } 52 107 … … 56 111 } 57 112 58 void WebInspectorProxy::platformInspectedURLChanged(const String& )113 void WebInspectorProxy::platformInspectedURLChanged(const String& url) 59 114 { 60 notImplemented(); 115 GOwnPtr<gchar> title(g_strdup_printf("%s - %s", _("Web Inspector"), url.utf8().data())); 116 gtk_window_set_title(GTK_WINDOW(m_inspectorWindow), title.get()); 61 117 } 62 118 63 119 String WebInspectorProxy::inspectorPageURL() const 64 120 { 65 notImplemented(); 66 return String(); 121 GOwnPtr<gchar> filePath(g_build_filename(inspectorFilesBasePath(), "inspector.html", NULL)); 122 GOwnPtr<gchar> fileURI(g_filename_to_uri(filePath.get(), 0, 0)); 123 return WebCore::filenameToString(fileURI.get()); 67 124 } 68 125 69 126 String WebInspectorProxy::inspectorBaseURL() const 70 127 { 71 notImplemented();72 return String();128 GOwnPtr<gchar> fileURI(g_filename_to_uri(inspectorFilesBasePath(), 0, 0)); 129 return WebCore::filenameToString(fileURI.get()); 73 130 } 74 131
Note: See TracChangeset
for help on using the changeset viewer.