Commit 55be1e2d authored by alp@webkit.org's avatar alp@webkit.org

2008-03-20 Alp Toker <alp@atoker.com>

        GTK+ build fix. Back out r31183. This patch also introduced API style
        issues.

        * WebCoreSupport/FrameLoaderClientGtk.cpp:
        (WebKit::FrameLoaderClient::dispatchDecidePolicyForNavigationAction):
        * webkit/headers.pri:
        * webkit/webkit-marshal.list:
        * webkit/webkitdefines.h:
        * webkit/webkitnavigationaction.cpp: Removed.
        * webkit/webkitnavigationaction.h: Removed.
        * webkit/webkitprivate.cpp:
        * webkit/webkitprivate.h:
        * webkit/webkitwebview.cpp:
        * webkit/webkitwebview.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@31184 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 2421f66e
2008-03-20 Alp Toker <alp@atoker.com>
GTK+ build fix. Back out r31183. This patch also introduced API style
issues.
* WebCoreSupport/FrameLoaderClientGtk.cpp:
(WebKit::FrameLoaderClient::dispatchDecidePolicyForNavigationAction):
* webkit/headers.pri:
* webkit/webkit-marshal.list:
* webkit/webkitdefines.h:
* webkit/webkitnavigationaction.cpp: Removed.
* webkit/webkitnavigationaction.h: Removed.
* webkit/webkitprivate.cpp:
* webkit/webkitprivate.h:
* webkit/webkitwebview.cpp:
* webkit/webkitwebview.h:
2008-03-20 Jasper Bryant-Greene <jasper@unix.geek.nz>
Reviewed and tweaked by Anders.
......
......@@ -40,7 +40,6 @@
#include "ProgressTracker.h"
#include "kjs_binding.h"
#include "kjs_proxy.h"
#include "webkitnavigationaction.h"
#include "webkitwebview.h"
#include "webkitwebframe.h"
#include "webkitprivate.h"
......@@ -246,9 +245,9 @@ void FrameLoaderClient::dispatchDecidePolicyForNavigationAction(FramePolicyFunct
WebKitWebView* webView = getViewFromFrame(m_frame);
WebKitNetworkRequest* request = webkit_network_request_new(resourceRequest.url().string().utf8().data());
WebKitNavigationResponse response = WEBKIT_NAVIGATION_RESPONSE_ACCEPT;
WebKitNavigationResponse response;
g_signal_emit_by_name(webView, "navigation-requested", kit(action), m_frame, request, &response);
g_signal_emit_by_name(webView, "navigation-requested", m_frame, request, &response);
g_object_unref(request);
......
WEBKIT_API_HEADERS = $$PWD/webkit.h \
$$PWD/webkitdefines.h \
$$PWD/webkitnavigationaction.h \
$$PWD/webkitnetworkrequest.h \
$$PWD/webkitwebbackforwardlist.h \
$$PWD/webkitwebframe.h \
......
......@@ -10,4 +10,3 @@ BOOLEAN:OBJECT,STRING
BOOLEAN:OBJECT,STRING,BOOLEAN
BOOLEAN:OBJECT,STRING,STRING,STRING
INT:OBJECT,OBJECT
INT:OBJECT,OBJECT,OBJECT
......@@ -40,9 +40,6 @@
G_BEGIN_DECLS
typedef struct _WebKitNavigationAction WebKitNavigationAction;
typedef struct _WebKitNavigationActionClass WebKitNavigationActionClass;
typedef struct _WebKitNetworkRequest WebKitNetworkRequest;
typedef struct _WebKitNetworkRequestClass WebKitNetworkRequestClass;
......
/*
* Copyright (C) 2008 Jasper Bryant-Greene <jasper@unix.geek.nz>
*
* 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.
* 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY APPLE 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 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 "webkitnavigationaction.h"
extern "C" {
G_DEFINE_TYPE(WebKitNavigationAction, webkit_navigation_action, G_TYPE_OBJECT);
struct _WebKitNavigationActionPrivate {
gint button;
gint modifierFlags;
gint navigationType;
gchar* originalURL;
};
#define WEBKIT_NAVIGATION_ACTION_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_NAVIGATION_ACTION, WebKitNavigationActionPrivate))
static void webkit_navigation_action_finalize(GObject* object)
{
WebKitNavigationAction* action = WEBKIT_NAVIGATION_ACTION(object);
WebKitNavigationActionPrivate* priv = action->priv;
g_free(priv->originalURL);
G_OBJECT_CLASS(webkit_navigation_action_parent_class)->finalize(object);
}
static void webkit_navigation_action_class_init(WebKitNavigationActionClass* klass)
{
G_OBJECT_CLASS(klass)->finalize = webkit_navigation_action_finalize;
g_type_class_add_private(klass, sizeof(WebKitNavigationActionPrivate));
}
static void webkit_navigation_action_init(WebKitNavigationAction* action)
{
WebKitNavigationActionPrivate* priv = WEBKIT_NAVIGATION_ACTION_GET_PRIVATE(action);
action->priv = priv;
}
gint webkit_navigation_action_get_button(WebKitNavigationAction* action)
{
g_return_val_if_fail(WEBKIT_IS_NAVIGATION_ACTION(action), 0);
return action->priv->button;
}
gint webkit_navigation_action_get_modifier_flags(WebKitNavigationAction* action)
{
g_return_val_if_fail(WEBKIT_IS_NAVIGATION_ACTION(action), 0);
return action->priv->modifierFlags;
}
gint webkit_navigation_action_get_navigation_type(WebKitNavigationAction* action)
{
g_return_val_if_fail(WEBKIT_IS_NAVIGATION_ACTION(action), 0);
return action->priv->navigationType;
}
G_CONST_RETURN gchar* webkit_navigation_action_get_original_url(WebKitNavigationAction* action)
{
g_return_val_if_fail(WEBKIT_IS_NAVIGATION_ACTION(action), NULL);
return action->priv->originalURL;
}
}
/*
* Copyright (C) 2008 Jasper Bryant-Greene <jasper@unix.geek.nz>
*
* 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.
* 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY APPLE 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 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 WEBKIT_NAVIGATION_ACTION_H
#define WEBKIT_NAVIGATION_ACTION_H
#include <glib-object.h>
#include <glib.h>
#include <webkit/webkitdefines.h>
G_BEGIN_DECLS
#define WEBKIT_TYPE_NAVIGATION_ACTION (webkit_navigation_action_get_type())
#define WEBKIT_NAVIGATION_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_NAVIGATION_ACTION, WebKitNavigationAction))
#define WEBKIT_NAVIGATION_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_NAVIGATION_ACTION, WebKitNavigationActionClass))
#define WEBKIT_IS_NAVIGATION_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_NAVIGATION_ACTION))
#define WEBKIT_IS_NAVIGATION_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_NAVIGATION_ACTION))
#define WEBKIT_NAVIGATION_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_NAVIGATION_ACTION, WebKitNavigationActionClass))
typedef struct _WebKitNavigationActionPrivate WebKitNavigationActionPrivate;
struct _WebKitNavigationAction {
GObject parent_instance;
WebKitNavigationActionPrivate* priv;
};
struct _WebKitNavigationActionClass {
GObjectClass parent_class;
};
WEBKIT_API GType
webkit_navigation_action_get_type (void);
WEBKIT_API gint
webkit_navigation_action_get_button (WebKitNavigationAction* action);
WEBKIT_API gint
webkit_navigation_action_get_modifier_flags (WebKitNavigationAction* action);
WEBKIT_API gint
webkit_navigation_action_get_navigation_type (WebKitNavigationAction* action);
WEBKIT_API G_CONST_RETURN gchar*
webkit_navigation_action_get_original_url (WebKitNavigationAction* action);
G_END_DECLS
#endif
/*
* Copyright (C) 2007 Holger Hans Peter Freyther
* Copyright (C) 2008 Jasper Bryant-Greene <jasper@unix.geek.nz>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -29,8 +28,6 @@
#include "NotImplemented.h"
#include "Pasteboard.h"
#include "PasteboardHelperGtk.h"
#include "MouseEvent.h"
#include "CString.h"
#if ENABLE(DATABASE)
#include "DatabaseTracker.h"
......@@ -84,39 +81,6 @@ WebKitWebView* kit(WebCore::Page* corePage)
return client ? client->webView() : 0;
}
WebKitNavigationAction* kit(const WebCore::NavigationAction& action)
{
WebKitNavigationAction* webKitAction = WEBKIT_NAVIGATION_ACTION(g_object_new(WEBKIT_TYPE_NAVIGATION_ACTION, NULL));
WebKitNavigationActionPrivate* priv = webKitAction->priv;
const Event* event = action.event();
if (event && event->isMouseEvent()) {
const MouseEvent* mouseEvent = static_cast<const MouseEvent*>(event);
priv->button = mouseEvent->button();
}
const UIEventWithKeyState* keyStateEvent = findEventWithKeyState(const_cast<Event*>(event));
if (keyStateEvent) {
int modifierFlags = 0;
if (keyStateEvent->shiftKey())
modifierFlags |= GDK_SHIFT_MASK;
if (keyStateEvent->ctrlKey())
modifierFlags |= GDK_CONTROL_MASK;
if (keyStateEvent->altKey())
modifierFlags |= GDK_MOD1_MASK;
if (keyStateEvent->metaKey())
modifierFlags |= GDK_MOD2_MASK;
priv->modifierFlags = modifierFlags;
}
priv->navigationType = action.type();
priv->originalURL = g_strdup(action.url().string().utf8().data());
return webKitAction;
}
} /** end namespace WebCore */
void webkit_init()
......
......@@ -31,7 +31,6 @@
#include <webkit/webkitwebframe.h>
#include <webkit/webkitwebsettings.h>
#include <webkit/webkitnetworkrequest.h>
#include <webkit/webkitnavigationaction.h>
#include <webkit/webkitwebbackforwardlist.h>
#include "BackForwardList.h"
......@@ -40,7 +39,6 @@
#include "Page.h"
#include "Frame.h"
#include "FrameLoaderClient.h"
#include "NavigationAction.h"
#include <glib.h>
......@@ -56,8 +54,6 @@ namespace WebKit {
WebCore::HistoryItem* core(WebKitWebHistoryItem*);
WebKitWebHistoryItem* kit(WebCore::HistoryItem*);
WebKitNavigationAction* kit(const WebCore::NavigationAction&);
WebCore::BackForwardList* core(WebKitWebBackForwardList*);
}
......@@ -110,15 +106,6 @@ extern "C" {
gchar* uri;
};
#define WEBKIT_NAVIGATION_ACTION_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_NAVIGATION_ACTION, WebKitNavigationActionPrivate))
typedef struct _WebKitNavigationActionPrivate WebKitNavigationActionPrivate;
struct _WebKitNavigationActionPrivate {
gint button;
gint modifierFlags;
gint navigationType;
gchar* originalURL;
};
WebKitWebFrame*
webkit_web_frame_init_with_web_view(WebKitWebView*, WebCore::HTMLFrameOwnerElement*);
......
......@@ -4,7 +4,6 @@
* Copyright (C) 2007 Xan Lopez <xan@gnome.org>
* Copyright (C) 2007 Alp Toker <alp@atoker.com>
* Copyright (C) 2008 Jan Alonzo <jmalonzo@unpluggable.com>
* Copyright (C) 2008 Jasper Bryant-Greene <jasper@unix.geek.nz>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -481,6 +480,12 @@ static WebKitWebView* webkit_web_view_real_create_web_view(WebKitWebView*)
return 0;
}
static WebKitNavigationResponse webkit_web_view_real_navigation_requested(WebKitWebView*, WebKitWebFrame* frame, WebKitNetworkRequest*)
{
notImplemented();
return WEBKIT_NAVIGATION_RESPONSE_ACCEPT;
}
static void webkit_web_view_real_window_object_cleared(WebKitWebView*, WebKitWebFrame*, JSGlobalContextRef context, JSObjectRef window_object)
{
notImplemented();
......@@ -659,33 +664,14 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
* Signals
*/
/**
* WebKitWebView::navigation-requested:
* @web_view: the object on which the signal is emitted
* @action: a WebKitNavigationAction that provides the context for this
* navigation request, such as mouse button and keyboard state (Shift,
* Control, Alt).
* @frame: the #WebKitWebFrame to do the navigation action
* @networkRequest: the WebKitNetworkRequest
* @return: a WebKitNavigationResponse, such as
* WEBKIT_NAVIGATION_RESPONSE_ACCEPT.
*
* Emitted when a #WebKitWebFrame of this #WebKitWebView is moving to a new
* location, such as when a HTML anchor is clicked. The WebKitNavigationAction
* provides context (such as which mouse button the anchor was clicked on by),
* and the application can return WEBKIT_NAVIGATION_RESPONSE_IGNORE (to instruct
* this #WebKitWebView to not open the URL itself) if the application would
* rather open the URL in a new tab, for example.
*/
webkit_web_view_signals[NAVIGATION_REQUESTED] = g_signal_new("navigation-requested",
G_TYPE_FROM_CLASS(webViewClass),
(GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
0,
G_STRUCT_OFFSET (WebKitWebViewClass, navigation_requested),
webkit_navigation_request_handled,
NULL,
webkit_marshal_INT__OBJECT_OBJECT_OBJECT,
G_TYPE_INT, 3,
G_TYPE_OBJECT,
webkit_marshal_INT__OBJECT_OBJECT,
G_TYPE_INT, 2,
G_TYPE_OBJECT,
G_TYPE_OBJECT);
......@@ -1005,6 +991,7 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
* implementations of virtual methods
*/
webViewClass->create_web_view = webkit_web_view_real_create_web_view;
webViewClass->navigation_requested = webkit_web_view_real_navigation_requested;
webViewClass->window_object_cleared = webkit_web_view_real_window_object_cleared;
webViewClass->choose_file = webkit_web_view_real_choose_file;
webViewClass->script_alert = webkit_web_view_real_script_alert;
......
......@@ -69,6 +69,11 @@ struct _WebKitWebViewClass {
*/
WebKitWebView* (*create_web_view) (WebKitWebView* web_view);
/*
* TODO: FIXME: Create something like WebPolicyDecisionListener_Protocol instead
*/
WebKitNavigationResponse (*navigation_requested) (WebKitWebView* web_view, WebKitWebFrame* frame, WebKitNetworkRequest* request);
void (*window_object_cleared) (WebKitWebView* web_view, WebKitWebFrame* frame, JSGlobalContextRef context, JSObjectRef window_object);
gchar* (*choose_file) (WebKitWebView* web_view, WebKitWebFrame* frame, const gchar* old_file);
gboolean (*script_alert) (WebKitWebView* web_view, WebKitWebFrame* frame, const gchar* alert_message);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment