summaryrefslogtreecommitdiff
path: root/Source/WebKit2/UIProcess/gtk
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit2/UIProcess/gtk')
-rw-r--r--Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp140
-rw-r--r--Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp66
-rw-r--r--Source/WebKit2/UIProcess/gtk/WebContextMenuProxyGtk.cpp126
-rw-r--r--Source/WebKit2/UIProcess/gtk/WebContextMenuProxyGtk.h63
-rw-r--r--Source/WebKit2/UIProcess/gtk/WebFullScreenManagerProxyGtk.cpp86
-rw-r--r--Source/WebKit2/UIProcess/gtk/WebInspectorGtk.cpp155
-rw-r--r--Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp62
-rw-r--r--Source/WebKit2/UIProcess/gtk/WebPopupMenuProxyGtk.cpp138
-rw-r--r--Source/WebKit2/UIProcess/gtk/WebPopupMenuProxyGtk.h62
-rw-r--r--Source/WebKit2/UIProcess/gtk/WebPreferencesGtk.cpp59
10 files changed, 957 insertions, 0 deletions
diff --git a/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp b/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp
new file mode 100644
index 000000000..5b26d1207
--- /dev/null
+++ b/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp
@@ -0,0 +1,140 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "TextChecker.h"
+
+#include "TextCheckerState.h"
+#include "WebTextChecker.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+static TextCheckerState textCheckerState;
+
+const TextCheckerState& TextChecker::state()
+{
+ static bool didInitializeState;
+ if (didInitializeState)
+ return textCheckerState;
+
+ WebTextCheckerClient& client = WebTextChecker::shared()->client();
+ textCheckerState.isContinuousSpellCheckingEnabled = client.continuousSpellCheckingEnabled();
+ textCheckerState.isGrammarCheckingEnabled = client.grammarCheckingEnabled();
+
+ didInitializeState = true;
+
+ return textCheckerState;
+}
+
+bool TextChecker::isContinuousSpellCheckingAllowed()
+{
+ return WebTextChecker::shared()->client().continuousSpellCheckingAllowed();
+}
+
+void TextChecker::setContinuousSpellCheckingEnabled(bool isContinuousSpellCheckingEnabled)
+{
+ if (state().isContinuousSpellCheckingEnabled == isContinuousSpellCheckingEnabled)
+ return;
+ textCheckerState.isContinuousSpellCheckingEnabled = isContinuousSpellCheckingEnabled;
+ WebTextChecker::shared()->client().setContinuousSpellCheckingEnabled(isContinuousSpellCheckingEnabled);
+}
+
+void TextChecker::setGrammarCheckingEnabled(bool isGrammarCheckingEnabled)
+{
+ if (state().isGrammarCheckingEnabled == isGrammarCheckingEnabled)
+ return;
+ textCheckerState.isGrammarCheckingEnabled = isGrammarCheckingEnabled;
+ WebTextChecker::shared()->client().setGrammarCheckingEnabled(isGrammarCheckingEnabled);
+}
+
+void TextChecker::continuousSpellCheckingEnabledStateChanged(bool enabled)
+{
+ textCheckerState.isContinuousSpellCheckingEnabled = enabled;
+}
+
+void TextChecker::grammarCheckingEnabledStateChanged(bool enabled)
+{
+ textCheckerState.isGrammarCheckingEnabled = enabled;
+}
+
+int64_t TextChecker::uniqueSpellDocumentTag(WebPageProxy* page)
+{
+ return WebTextChecker::shared()->client().uniqueSpellDocumentTag(page);
+}
+
+void TextChecker::closeSpellDocumentWithTag(int64_t tag)
+{
+ WebTextChecker::shared()->client().closeSpellDocumentWithTag(tag);
+}
+
+void TextChecker::checkSpellingOfString(int64_t spellDocumentTag, const UChar* text, uint32_t length, int32_t& misspellingLocation, int32_t& misspellingLength)
+{
+ WebTextChecker::shared()->client().checkSpellingOfString(spellDocumentTag, String(text, length), misspellingLocation, misspellingLength);
+}
+
+void TextChecker::checkGrammarOfString(int64_t spellDocumentTag, const UChar* text, uint32_t length, Vector<WebCore::GrammarDetail>& grammarDetails, int32_t& badGrammarLocation, int32_t& badGrammarLength)
+{
+ WebTextChecker::shared()->client().checkGrammarOfString(spellDocumentTag, String(text, length), grammarDetails, badGrammarLocation, badGrammarLength);
+}
+
+bool TextChecker::spellingUIIsShowing()
+{
+ return WebTextChecker::shared()->client().spellingUIIsShowing();
+}
+
+void TextChecker::toggleSpellingUIIsShowing()
+{
+ WebTextChecker::shared()->client().toggleSpellingUIIsShowing();
+}
+
+void TextChecker::updateSpellingUIWithMisspelledWord(int64_t spellDocumentTag, const String& misspelledWord)
+{
+ WebTextChecker::shared()->client().updateSpellingUIWithMisspelledWord(spellDocumentTag, misspelledWord);
+}
+
+void TextChecker::updateSpellingUIWithGrammarString(int64_t spellDocumentTag, const String& badGrammarPhrase, const GrammarDetail& grammarDetail)
+{
+ WebTextChecker::shared()->client().updateSpellingUIWithGrammarString(spellDocumentTag, badGrammarPhrase, grammarDetail);
+}
+
+void TextChecker::getGuessesForWord(int64_t spellDocumentTag, const String& word, const String& context, Vector<String>& guesses)
+{
+ WebTextChecker::shared()->client().guessesForWord(spellDocumentTag, word, guesses);
+}
+
+void TextChecker::learnWord(int64_t spellDocumentTag, const String& word)
+{
+ WebTextChecker::shared()->client().learnWord(spellDocumentTag, word);
+}
+
+void TextChecker::ignoreWord(int64_t spellDocumentTag, const String& word)
+{
+ WebTextChecker::shared()->client().ignoreWord(spellDocumentTag, word);
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp b/Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp
new file mode 100644
index 000000000..71c7bbe3c
--- /dev/null
+++ b/Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebContext.h"
+#include <WebCore/FileSystem.h>
+#include <wtf/gobject/GOwnPtr.h>
+
+namespace WebKit {
+
+WTF::String WebContext::applicationCacheDirectory()
+{
+ GOwnPtr<gchar> cacheDirectory(g_build_filename(g_get_user_cache_dir(), "webkitgtk", "applications", NULL));
+ return WebCore::filenameToString(cacheDirectory.get());
+}
+
+void WebContext::platformInitializeWebProcess(WebProcessCreationParameters&)
+{
+}
+
+void WebContext::platformInvalidateContext()
+{
+}
+
+String WebContext::platformDefaultDatabaseDirectory() const
+{
+ GOwnPtr<gchar> databaseDirectory(g_build_filename(g_get_user_data_dir(), "webkitgtk", "databases", NULL));
+ return WebCore::filenameToString(databaseDirectory.get());
+}
+
+String WebContext::platformDefaultIconDatabasePath() const
+{
+ // FIXME: Implement.
+ return WTF::String();
+}
+
+String WebContext::platformDefaultLocalStorageDirectory() const
+{
+ GOwnPtr<gchar> storageDirectory(g_build_filename(g_get_user_data_dir(), "webkitgtk", "localstorage", NULL));
+ return WebCore::filenameToString(storageDirectory.get());
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/gtk/WebContextMenuProxyGtk.cpp b/Source/WebKit2/UIProcess/gtk/WebContextMenuProxyGtk.cpp
new file mode 100644
index 000000000..d85b3dda2
--- /dev/null
+++ b/Source/WebKit2/UIProcess/gtk/WebContextMenuProxyGtk.cpp
@@ -0,0 +1,126 @@
+/*
+ * Copyright (C) 2011 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebContextMenuProxyGtk.h"
+
+#include "NativeWebMouseEvent.h"
+#include "WebContextMenuItemData.h"
+#include "WebPageProxy.h"
+#include <WebCore/ContextMenu.h>
+#include <WebCore/GtkUtilities.h>
+#include <gtk/gtk.h>
+#include <wtf/text/CString.h>
+
+
+static const char* gContextMenuActionId = "webkit-context-menu-action";
+
+using namespace WebCore;
+
+namespace WebKit {
+
+static void contextMenuItemActivatedCallback(GtkAction* action, WebPageProxy* page)
+{
+ gboolean isToggle = GTK_IS_TOGGLE_ACTION(action);
+ WebKit::WebContextMenuItemData item(isToggle ? WebCore::CheckableActionType : WebCore::ActionType,
+ static_cast<WebCore::ContextMenuAction>(GPOINTER_TO_INT(g_object_get_data(G_OBJECT(action), gContextMenuActionId))),
+ gtk_action_get_label(action), gtk_action_get_sensitive(action),
+ isToggle ? gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action)) : false);
+ page->contextMenuItemSelected(item);
+}
+
+GtkMenu* WebContextMenuProxyGtk::createGtkMenu(const Vector<WebContextMenuItemData>& items)
+{
+ ContextMenu menu;
+ for (size_t i = 0; i < items.size(); i++) {
+ const WebContextMenuItemData& item = items.at(i);
+ ContextMenuItem menuItem(item.type(), item.action(), item.title(), item.enabled(), item.checked());
+ GtkAction* action = menuItem.gtkAction();
+
+ if (action && (item.type() == WebCore::ActionType || item.type() == WebCore::CheckableActionType)) {
+ g_object_set_data(G_OBJECT(action), gContextMenuActionId, GINT_TO_POINTER(item.action()));
+ g_signal_connect(action, "activate", G_CALLBACK(contextMenuItemActivatedCallback), m_page);
+ }
+
+ if (item.type() == WebCore::SubmenuType) {
+ ContextMenu subMenu(createGtkMenu(item.submenu()));
+ menuItem.setSubMenu(&subMenu);
+ }
+ menu.appendItem(menuItem);
+ }
+ return menu.releasePlatformDescription();
+}
+
+void WebContextMenuProxyGtk::showContextMenu(const WebCore::IntPoint& position, const Vector<WebContextMenuItemData>& items)
+{
+ if (items.isEmpty())
+ return;
+
+ m_popup = createGtkMenu(items);
+ m_popupPosition = convertWidgetPointToScreenPoint(m_webView, position);
+
+ // Display menu initiated by right click (mouse button pressed = 3).
+ NativeWebMouseEvent* mouseEvent = m_page->currentlyProcessedMouseDownEvent();
+ const GdkEvent* event = mouseEvent ? mouseEvent->nativeEvent() : 0;
+ gtk_menu_popup(m_popup, 0, 0, reinterpret_cast<GtkMenuPositionFunc>(menuPositionFunction), this,
+ event ? event->button.button : 3, event ? event->button.time : GDK_CURRENT_TIME);
+}
+
+void WebContextMenuProxyGtk::hideContextMenu()
+{
+ gtk_menu_popdown(m_popup);
+}
+
+WebContextMenuProxyGtk::WebContextMenuProxyGtk(GtkWidget* webView, WebPageProxy* page)
+ : m_webView(webView)
+ , m_page(page)
+ , m_popup(0)
+{
+}
+
+WebContextMenuProxyGtk::~WebContextMenuProxyGtk()
+{
+ if (m_popup)
+ gtk_widget_destroy(GTK_WIDGET(m_popup));
+}
+
+void WebContextMenuProxyGtk::menuPositionFunction(GtkMenu* menu, gint* x, gint* y, gboolean* pushIn, WebContextMenuProxyGtk* popupMenu)
+{
+ GtkRequisition menuSize;
+ gtk_widget_get_preferred_size(GTK_WIDGET(menu), &menuSize, 0);
+
+ GdkScreen* screen = gtk_widget_get_screen(popupMenu->m_webView);
+ *x = popupMenu->m_popupPosition.x();
+ if ((*x + menuSize.width) >= gdk_screen_get_width(screen))
+ *x -= menuSize.width;
+
+ *y = popupMenu->m_popupPosition.y();
+ if ((*y + menuSize.height) >= gdk_screen_get_height(screen))
+ *y -= menuSize.height;
+
+ *pushIn = FALSE;
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/gtk/WebContextMenuProxyGtk.h b/Source/WebKit2/UIProcess/gtk/WebContextMenuProxyGtk.h
new file mode 100644
index 000000000..b6a95778b
--- /dev/null
+++ b/Source/WebKit2/UIProcess/gtk/WebContextMenuProxyGtk.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2011 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebContextMenuProxyGtk_h
+#define WebContextMenuProxyGtk_h
+
+#include "WebContextMenuProxy.h"
+#include <WebCore/IntPoint.h>
+
+namespace WebKit {
+
+class WebContextMenuItemData;
+class WebPageProxy;
+
+class WebContextMenuProxyGtk : public WebContextMenuProxy {
+public:
+ static PassRefPtr<WebContextMenuProxyGtk> create(GtkWidget* webView, WebPageProxy* page)
+ {
+ return adoptRef(new WebContextMenuProxyGtk(webView, page));
+ }
+ ~WebContextMenuProxyGtk();
+
+ virtual void showContextMenu(const WebCore::IntPoint&, const Vector<WebContextMenuItemData>&);
+ virtual void hideContextMenu();
+
+private:
+ WebContextMenuProxyGtk(GtkWidget*, WebPageProxy*);
+ GtkMenu* createGtkMenu(const Vector<WebContextMenuItemData>&);
+
+ static void menuPositionFunction(GtkMenu*, gint*, gint*, gboolean*, WebContextMenuProxyGtk*);
+
+ GtkWidget* m_webView;
+ WebPageProxy* m_page;
+ GtkMenu* m_popup;
+ WebCore::IntPoint m_popupPosition;
+};
+
+
+} // namespace WebKit
+
+#endif // WebContextMenuProxyGtk_h
diff --git a/Source/WebKit2/UIProcess/gtk/WebFullScreenManagerProxyGtk.cpp b/Source/WebKit2/UIProcess/gtk/WebFullScreenManagerProxyGtk.cpp
new file mode 100644
index 000000000..5b5bf0242
--- /dev/null
+++ b/Source/WebKit2/UIProcess/gtk/WebFullScreenManagerProxyGtk.cpp
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2011 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WebFullScreenManagerProxy.h"
+
+#if ENABLE(FULLSCREEN_API)
+
+#include "WebContext.h"
+#include "WebFullScreenManagerMessages.h"
+#include "WebFullScreenManagerProxyMessages.h"
+#include "WebProcess.h"
+
+#include <WebCore/NotImplemented.h>
+
+namespace WebKit {
+
+void WebFullScreenManagerProxy::invalidate()
+{
+ m_webView = 0;
+}
+
+void WebFullScreenManagerProxy::enterFullScreen()
+{
+ notImplemented();
+}
+
+void WebFullScreenManagerProxy::exitFullScreen()
+{
+ notImplemented();
+}
+
+void WebFullScreenManagerProxy::beganEnterFullScreenAnimation()
+{
+ notImplemented();
+}
+
+void WebFullScreenManagerProxy::finishedEnterFullScreenAnimation(bool completed)
+{
+ notImplemented();
+}
+
+void WebFullScreenManagerProxy::beganExitFullScreenAnimation()
+{
+ notImplemented();
+}
+
+void WebFullScreenManagerProxy::finishedExitFullScreenAnimation(bool completed)
+{
+ notImplemented();
+}
+
+void WebFullScreenManagerProxy::enterAcceleratedCompositingMode(const LayerTreeContext& context)
+{
+ notImplemented();
+}
+
+void WebFullScreenManagerProxy::exitAcceleratedCompositingMode()
+{
+ notImplemented();
+}
+
+void WebFullScreenManagerProxy::getFullScreenRect(WebCore::IntRect& rect)
+{
+ notImplemented();
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(FULLSCREEN_API)
diff --git a/Source/WebKit2/UIProcess/gtk/WebInspectorGtk.cpp b/Source/WebKit2/UIProcess/gtk/WebInspectorGtk.cpp
new file mode 100644
index 000000000..1be2a0000
--- /dev/null
+++ b/Source/WebKit2/UIProcess/gtk/WebInspectorGtk.cpp
@@ -0,0 +1,155 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebInspectorProxy.h"
+
+#if ENABLE(INSPECTOR)
+
+#include "WebKitWebViewBasePrivate.h"
+#include "WebProcessProxy.h"
+
+#include <WebCore/FileSystem.h>
+#include <WebCore/NotImplemented.h>
+#include <glib/gi18n-lib.h>
+#include <gtk/gtk.h>
+#include <wtf/gobject/GOwnPtr.h>
+#include <wtf/text/CString.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebKit {
+
+static const char* inspectorFilesBasePath()
+{
+ const gchar* environmentPath = g_getenv("WEBKIT_INSPECTOR_PATH");
+ if (environmentPath && g_file_test(environmentPath, G_FILE_TEST_IS_DIR))
+ return environmentPath;
+
+ static const char* inspectorFilesPath = DATA_DIR""G_DIR_SEPARATOR_S
+ "webkitgtk-"WEBKITGTK_API_VERSION_STRING""G_DIR_SEPARATOR_S
+ "webinspector"G_DIR_SEPARATOR_S;
+ return inspectorFilesPath;
+}
+
+static gboolean inspectorWindowDestroyed(GtkWidget* window, GdkEvent*, gpointer userData)
+{
+ WebInspectorProxy* inspectorProxy = static_cast<WebInspectorProxy*>(userData);
+
+ // Inform WebProcess about webinspector closure. Not doing so,
+ // results in failure of subsequent invocation of webinspector.
+ inspectorProxy->close();
+ inspectorProxy->windowDestroyed();
+
+ return FALSE;
+}
+
+void WebInspectorProxy::windowDestroyed()
+{
+ ASSERT(m_inspectorView);
+ ASSERT(m_inspectorWindow);
+ m_inspectorView = 0;
+ m_inspectorWindow = 0;
+}
+
+WebPageProxy* WebInspectorProxy::platformCreateInspectorPage()
+{
+ ASSERT(m_page);
+ ASSERT(!m_inspectorView);
+ m_inspectorView = GTK_WIDGET(webkitWebViewBaseCreate(page()->process()->context(), inspectorPageGroup()));
+ return webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(m_inspectorView));
+}
+
+void WebInspectorProxy::platformOpen()
+{
+ ASSERT(!m_inspectorWindow);
+ m_inspectorWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+
+ gtk_window_set_title(GTK_WINDOW(m_inspectorWindow), _("Web Inspector"));
+ gtk_window_set_default_size(GTK_WINDOW(m_inspectorWindow), initialWindowWidth, initialWindowHeight);
+ g_signal_connect(m_inspectorWindow, "delete-event", G_CALLBACK(inspectorWindowDestroyed), this);
+
+ gtk_container_add(GTK_CONTAINER(m_inspectorWindow), m_inspectorView);
+ gtk_widget_show(m_inspectorView);
+ gtk_widget_show(m_inspectorWindow);
+}
+
+void WebInspectorProxy::platformDidClose()
+{
+ if (m_inspectorWindow) {
+ gtk_widget_destroy(m_inspectorWindow);
+ m_inspectorWindow = 0;
+ m_inspectorView = 0;
+ }
+}
+
+void WebInspectorProxy::platformBringToFront()
+{
+ notImplemented();
+}
+
+void WebInspectorProxy::platformInspectedURLChanged(const String& url)
+{
+ GOwnPtr<gchar> title(g_strdup_printf("%s - %s", _("Web Inspector"), url.utf8().data()));
+ gtk_window_set_title(GTK_WINDOW(m_inspectorWindow), title.get());
+}
+
+String WebInspectorProxy::inspectorPageURL() const
+{
+ GOwnPtr<gchar> filePath(g_build_filename(inspectorFilesBasePath(), "inspector.html", NULL));
+ GOwnPtr<gchar> fileURI(g_filename_to_uri(filePath.get(), 0, 0));
+ return WebCore::filenameToString(fileURI.get());
+}
+
+String WebInspectorProxy::inspectorBaseURL() const
+{
+ GOwnPtr<gchar> fileURI(g_filename_to_uri(inspectorFilesBasePath(), 0, 0));
+ return WebCore::filenameToString(fileURI.get());
+}
+
+unsigned WebInspectorProxy::platformInspectedWindowHeight()
+{
+ notImplemented();
+ return 0;
+}
+
+void WebInspectorProxy::platformAttach()
+{
+ notImplemented();
+}
+
+void WebInspectorProxy::platformDetach()
+{
+ notImplemented();
+}
+
+void WebInspectorProxy::platformSetAttachedWindowHeight(unsigned)
+{
+ notImplemented();
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(INSPECTOR)
diff --git a/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp b/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp
new file mode 100644
index 000000000..1127dde84
--- /dev/null
+++ b/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebPageProxy.h"
+
+#include "NativeWebKeyboardEvent.h"
+#include "NotImplemented.h"
+#include "PageClientImpl.h"
+
+namespace WebKit {
+
+GtkWidget* WebPageProxy::viewWidget()
+{
+ return static_cast<PageClientImpl*>(m_pageClient)->viewWidget();
+}
+
+String WebPageProxy::standardUserAgent(const String& applicationNameForUserAgent)
+{
+ // FIXME: This should not be hard coded.
+ return "Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.7 (KHTML, like Gecko) Version/5.0 Safari/534.7";
+}
+
+void WebPageProxy::getEditorCommandsForKeyEvent(const AtomicString& eventType, Vector<WTF::String>& commandsList)
+{
+ m_pageClient->getEditorCommandsForKeyEvent(m_keyEventQueue.first(), eventType, commandsList);
+}
+
+void WebPageProxy::saveRecentSearches(const String&, const Vector<String>&)
+{
+ notImplemented();
+}
+
+void WebPageProxy::loadRecentSearches(const String&, Vector<String>&)
+{
+ notImplemented();
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/gtk/WebPopupMenuProxyGtk.cpp b/Source/WebKit2/UIProcess/gtk/WebPopupMenuProxyGtk.cpp
new file mode 100644
index 000000000..521cf5320
--- /dev/null
+++ b/Source/WebKit2/UIProcess/gtk/WebPopupMenuProxyGtk.cpp
@@ -0,0 +1,138 @@
+/*
+ * Copyright (C) 2011 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebPopupMenuProxyGtk.h"
+
+#include "NativeWebMouseEvent.h"
+#include "WebPopupItem.h"
+#include <WebCore/GtkUtilities.h>
+#include <gtk/gtk.h>
+#include <wtf/gobject/GOwnPtr.h>
+#include <wtf/text/CString.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+WebPopupMenuProxyGtk::WebPopupMenuProxyGtk(GtkWidget* webView, WebPopupMenuProxy::Client* client)
+ : WebPopupMenuProxy(client)
+ , m_webView(webView)
+ , m_activeItem(-1)
+ , m_runLoop(0)
+{
+}
+
+WebPopupMenuProxyGtk::~WebPopupMenuProxyGtk()
+{
+ if (m_popup) {
+ g_signal_handlers_disconnect_matched(m_popup->platformMenu(), G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, this);
+ hidePopupMenu();
+ }
+}
+
+GtkAction* WebPopupMenuProxyGtk::createGtkActionForMenuItem(const WebPopupItem& item, int itemIndex)
+{
+ GOwnPtr<char> actionName(g_strdup_printf("popup-menu-action-%d", itemIndex));
+ GtkAction* action = gtk_action_new(actionName.get(), item.m_text.utf8().data(), item.m_toolTip.utf8().data(), 0);
+ g_object_set_data(G_OBJECT(action), "popup-menu-action-index", GINT_TO_POINTER(itemIndex));
+ g_signal_connect(action, "activate", G_CALLBACK(menuItemActivated), this);
+ gtk_action_set_sensitive(action, item.m_isEnabled);
+
+ return action;
+}
+
+void WebPopupMenuProxyGtk::showPopupMenu(const IntRect& rect, TextDirection textDirection, double pageScaleFactor, const Vector<WebPopupItem>& items, const PlatformPopupMenuData& data, int32_t selectedIndex)
+{
+ if (m_popup)
+ m_popup->clear();
+ else
+ m_popup = GtkPopupMenu::create();
+
+ const int size = items.size();
+ for (int i = 0; i < size; i++) {
+ if (items[i].m_type == WebPopupItem::Separator)
+ m_popup->appendSeparator();
+ else {
+ GRefPtr<GtkAction> action = adoptGRef(createGtkActionForMenuItem(items[i], i));
+ m_popup->appendItem(action.get());
+ }
+ }
+
+ IntPoint menuPosition = convertWidgetPointToScreenPoint(m_webView, rect.location());
+ menuPosition.move(0, rect.height());
+
+ gulong unmapHandler = g_signal_connect(m_popup->platformMenu(), "unmap", G_CALLBACK(menuUnmapped), this);
+ m_popup->popUp(rect.size(), menuPosition, size, selectedIndex, m_client->currentlyProcessedMouseDownEvent() ? m_client->currentlyProcessedMouseDownEvent()->nativeEvent() : 0);
+
+ // PopupMenu can fail to open when there is no mouse grab.
+ // Ensure WebCore does not go into some pesky state.
+ if (!gtk_widget_get_visible(m_popup->platformMenu())) {
+ m_client->failedToShowPopupMenu();
+ return;
+ }
+
+ // WebPageProxy expects the menu to run in a nested run loop, since it invalidates the
+ // menu right after calling WebPopupMenuProxy::showPopupMenu().
+ m_runLoop = g_main_loop_new(0, FALSE);
+
+ GDK_THREADS_LEAVE();
+ g_main_loop_run(m_runLoop);
+ GDK_THREADS_ENTER();
+
+ g_main_loop_unref(m_runLoop);
+ m_runLoop = 0;
+
+ g_signal_handler_disconnect(m_popup->platformMenu(), unmapHandler);
+
+ if (!m_client)
+ return;
+
+ m_client->valueChangedForPopupMenu(this, m_activeItem);
+}
+
+void WebPopupMenuProxyGtk::hidePopupMenu()
+{
+ m_popup->popDown();
+}
+
+void WebPopupMenuProxyGtk::shutdownRunLoop()
+{
+ if (g_main_loop_is_running(m_runLoop))
+ g_main_loop_quit(m_runLoop);
+}
+
+void WebPopupMenuProxyGtk::menuItemActivated(GtkAction* action, WebPopupMenuProxyGtk* popupMenu)
+{
+ popupMenu->setActiveItem(GPOINTER_TO_INT(g_object_get_data(G_OBJECT(action), "popup-menu-action-index")));
+ popupMenu->shutdownRunLoop();
+}
+
+void WebPopupMenuProxyGtk::menuUnmapped(GtkWidget*, WebPopupMenuProxyGtk* popupMenu)
+{
+ popupMenu->shutdownRunLoop();
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/gtk/WebPopupMenuProxyGtk.h b/Source/WebKit2/UIProcess/gtk/WebPopupMenuProxyGtk.h
new file mode 100644
index 000000000..9399ec11f
--- /dev/null
+++ b/Source/WebKit2/UIProcess/gtk/WebPopupMenuProxyGtk.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2011 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WebPopupMenuProxyGtk_h
+#define WebPopupMenuProxyGtk_h
+
+#include "WebPopupMenuProxy.h"
+#include <WebCore/GtkPopupMenu.h>
+#include <WebCore/IntRect.h>
+
+typedef struct _GMainLoop GMainLoop;
+
+namespace WebKit {
+
+class WebPageProxy;
+
+class WebPopupMenuProxyGtk : public WebPopupMenuProxy {
+public:
+ static PassRefPtr<WebPopupMenuProxyGtk> create(GtkWidget* webView, WebPopupMenuProxy::Client* client)
+ {
+ return adoptRef(new WebPopupMenuProxyGtk(webView, client));
+ }
+ ~WebPopupMenuProxyGtk();
+
+ virtual void showPopupMenu(const WebCore::IntRect&, WebCore::TextDirection, double pageScaleFactor, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex);
+ virtual void hidePopupMenu();
+
+private:
+ WebPopupMenuProxyGtk(GtkWidget*, WebPopupMenuProxy::Client*);
+ void shutdownRunLoop();
+ void setActiveItem(int activeItem) { m_activeItem = activeItem; }
+ GtkAction* createGtkActionForMenuItem(const WebPopupItem&, int itemIndex);
+
+ static void menuItemActivated(GtkAction*, WebPopupMenuProxyGtk*);
+ static void menuUnmapped(GtkWidget*, WebPopupMenuProxyGtk*);
+
+ GtkWidget* m_webView;
+ OwnPtr<WebCore::GtkPopupMenu> m_popup;
+ int m_activeItem;
+ GMainLoop* m_runLoop;
+};
+
+} // namespace WebKit
+
+
+#endif // WebPopupMenuProxyGtk_h
diff --git a/Source/WebKit2/UIProcess/gtk/WebPreferencesGtk.cpp b/Source/WebKit2/UIProcess/gtk/WebPreferencesGtk.cpp
new file mode 100644
index 000000000..c69820416
--- /dev/null
+++ b/Source/WebKit2/UIProcess/gtk/WebPreferencesGtk.cpp
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebPreferences.h"
+
+#include <WebCore/NotImplemented.h>
+
+namespace WebKit {
+
+void WebPreferences::platformInitializeStore()
+{
+ notImplemented();
+}
+
+void WebPreferences::platformUpdateStringValueForKey(const String&, const String&)
+{
+ notImplemented();
+}
+
+void WebPreferences::platformUpdateBoolValueForKey(const String&, bool)
+{
+ notImplemented();
+}
+
+void WebPreferences::platformUpdateUInt32ValueForKey(const String&, uint32_t)
+{
+ notImplemented();
+}
+
+void WebPreferences::platformUpdateDoubleValueForKey(const String&, double)
+{
+ notImplemented();
+}
+
+} // namespace WebKit