Lines 5-10
Link Here
|
5 |
* Copyright (C) 2007 Alp Toker <alp@atoker.com> |
5 |
* Copyright (C) 2007 Alp Toker <alp@atoker.com> |
6 |
* Copyright (C) 2008 Jan Alonzo <jmalonzo@unpluggable.com> |
6 |
* Copyright (C) 2008 Jan Alonzo <jmalonzo@unpluggable.com> |
7 |
* Copyright (C) 2008 Nuanti Ltd. |
7 |
* Copyright (C) 2008 Nuanti Ltd. |
|
|
8 |
* Copyright (C) 2008 Collabora Ltd. |
8 |
* |
9 |
* |
9 |
* This library is free software; you can redistribute it and/or |
10 |
* This library is free software; you can redistribute it and/or |
10 |
* modify it under the terms of the GNU Lesser General Public |
11 |
* modify it under the terms of the GNU Lesser General Public |
Lines 69-74
extern "C" {
Link Here
|
69 |
enum { |
70 |
enum { |
70 |
/* normal signals */ |
71 |
/* normal signals */ |
71 |
NAVIGATION_REQUESTED, |
72 |
NAVIGATION_REQUESTED, |
|
|
73 |
MIME_TYPE_POLICY_DECISION_REQUESTED, |
72 |
WINDOW_OBJECT_CLEARED, |
74 |
WINDOW_OBJECT_CLEARED, |
73 |
LOAD_STARTED, |
75 |
LOAD_STARTED, |
74 |
LOAD_COMMITTED, |
76 |
LOAD_COMMITTED, |
Lines 539-550
static WebKitWebView* webkit_web_view_real_create_web_view(WebKitWebView*)
Link Here
|
539 |
return 0; |
541 |
return 0; |
540 |
} |
542 |
} |
541 |
|
543 |
|
542 |
static WebKitNavigationResponse webkit_web_view_real_navigation_requested(WebKitWebView*, WebKitWebFrame* frame, WebKitNetworkRequest*) |
|
|
543 |
{ |
544 |
notImplemented(); |
545 |
return WEBKIT_NAVIGATION_RESPONSE_ACCEPT; |
546 |
} |
547 |
|
548 |
static void webkit_web_view_real_window_object_cleared(WebKitWebView*, WebKitWebFrame*, JSGlobalContextRef context, JSObjectRef window_object) |
544 |
static void webkit_web_view_real_window_object_cleared(WebKitWebView*, WebKitWebFrame*, JSGlobalContextRef context, JSObjectRef window_object) |
549 |
{ |
545 |
{ |
550 |
notImplemented(); |
546 |
notImplemented(); |
Lines 705-722
static void webkit_web_view_finalize(GObject* object)
Link Here
|
705 |
G_OBJECT_CLASS(webkit_web_view_parent_class)->finalize(object); |
701 |
G_OBJECT_CLASS(webkit_web_view_parent_class)->finalize(object); |
706 |
} |
702 |
} |
707 |
|
703 |
|
708 |
static gboolean webkit_navigation_request_handled(GSignalInvocationHint* ihint, GValue* returnAccu, const GValue* handlerReturn, gpointer dummy) |
|
|
709 |
{ |
710 |
gboolean continueEmission = TRUE; |
711 |
int signalHandled = g_value_get_int(handlerReturn); |
712 |
g_value_set_int(returnAccu, signalHandled); |
713 |
|
714 |
if (signalHandled != WEBKIT_NAVIGATION_RESPONSE_ACCEPT) |
715 |
continueEmission = FALSE; |
716 |
|
717 |
return continueEmission; |
718 |
} |
719 |
|
720 |
static AtkObject* webkit_web_view_get_accessible(GtkWidget* widget) |
704 |
static AtkObject* webkit_web_view_get_accessible(GtkWidget* widget) |
721 |
{ |
705 |
{ |
722 |
WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); |
706 |
WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); |
Lines 747-762
static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
Link Here
|
747 |
* Signals |
731 |
* Signals |
748 |
*/ |
732 |
*/ |
749 |
|
733 |
|
|
|
734 |
/** |
735 |
* WebKitWebView::navigation-requested: |
736 |
* @web_view: the object on which the signal is emitted |
737 |
* @frame: the #WebKitWebFrame that required the navigation |
738 |
* @request: a #WebKitNetworkRequest |
739 |
* @navigation_action: a #WebKitWebNavigation |
740 |
* @policy_decision: a #WebKitWebPolicyDecision |
741 |
* @return: TRUE if the signal will be handled, |
742 |
* FALSE to have the default behavior apply |
743 |
* |
744 |
* Emitted when @frame requests a navigation to another page. |
745 |
* If this signal is not handled, the default behavior is to allow the |
746 |
* navigation. |
747 |
*/ |
750 |
webkit_web_view_signals[NAVIGATION_REQUESTED] = g_signal_new("navigation-requested", |
748 |
webkit_web_view_signals[NAVIGATION_REQUESTED] = g_signal_new("navigation-requested", |
751 |
G_TYPE_FROM_CLASS(webViewClass), |
749 |
G_TYPE_FROM_CLASS(webViewClass), |
752 |
(GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), |
750 |
(GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), |
753 |
G_STRUCT_OFFSET (WebKitWebViewClass, navigation_requested), |
751 |
0, |
754 |
webkit_navigation_request_handled, |
752 |
g_signal_accumulator_true_handled, |
755 |
NULL, |
753 |
NULL, |
756 |
webkit_marshal_INT__OBJECT_OBJECT, |
754 |
webkit_marshal_BOOLEAN__OBJECT_OBJECT_OBJECT_OBJECT, |
757 |
G_TYPE_INT, 2, |
755 |
G_TYPE_BOOLEAN, 4, |
758 |
G_TYPE_OBJECT, |
756 |
WEBKIT_TYPE_WEB_FRAME, |
759 |
G_TYPE_OBJECT); |
757 |
WEBKIT_TYPE_NETWORK_REQUEST, |
|
|
758 |
WEBKIT_TYPE_WEB_NAVIGATION_ACTION, |
759 |
WEBKIT_TYPE_WEB_POLICY_DECISION); |
760 |
|
761 |
/** |
762 |
* WebKitWebView::mime-type-policy-decision-requested: |
763 |
* @web_view: the object on which the signal is emitted |
764 |
* @frame: the #WebKitWebFrame that required the policy decision |
765 |
* @request: a WebKitNetworkRequest |
766 |
* @mimetype: the MIME type attempted to load |
767 |
* @policy_decision: a #WebKitWebPolicyDecision |
768 |
* @return: TRUE if the signal will be handled, |
769 |
* FALSE to have the default behavior apply |
770 |
* |
771 |
* Decide whether or not to display of not the given MIME type. |
772 |
* If this signal is not handled, the default behavior is to show the |
773 |
* content of the requested URI if WebKit can show this MIME type, |
774 |
* else it will be ignored. |
775 |
*/ |
776 |
webkit_web_view_signals[MIME_TYPE_POLICY_DECISION_REQUESTED] = g_signal_new("mime-type-policy-decision-requested", |
777 |
G_TYPE_FROM_CLASS(webViewClass), |
778 |
(GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), |
779 |
0, |
780 |
g_signal_accumulator_true_handled, |
781 |
NULL, |
782 |
webkit_marshal_BOOLEAN__OBJECT_OBJECT_STRING_OBJECT, |
783 |
G_TYPE_BOOLEAN, 4, |
784 |
WEBKIT_TYPE_WEB_FRAME, |
785 |
WEBKIT_TYPE_NETWORK_REQUEST, |
786 |
G_TYPE_STRING, |
787 |
WEBKIT_TYPE_WEB_POLICY_DECISION); |
760 |
|
788 |
|
761 |
/** |
789 |
/** |
762 |
* WebKitWebView::window-object-cleared: |
790 |
* WebKitWebView::window-object-cleared: |
Lines 1074-1080
static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
Link Here
|
1074 |
* implementations of virtual methods |
1102 |
* implementations of virtual methods |
1075 |
*/ |
1103 |
*/ |
1076 |
webViewClass->create_web_view = webkit_web_view_real_create_web_view; |
1104 |
webViewClass->create_web_view = webkit_web_view_real_create_web_view; |
1077 |
webViewClass->navigation_requested = webkit_web_view_real_navigation_requested; |
|
|
1078 |
webViewClass->window_object_cleared = webkit_web_view_real_window_object_cleared; |
1105 |
webViewClass->window_object_cleared = webkit_web_view_real_window_object_cleared; |
1079 |
webViewClass->choose_file = webkit_web_view_real_choose_file; |
1106 |
webViewClass->choose_file = webkit_web_view_real_choose_file; |
1080 |
webViewClass->script_alert = webkit_web_view_real_script_alert; |
1107 |
webViewClass->script_alert = webkit_web_view_real_script_alert; |
Lines 1993-1998
GtkTargetList* webkit_web_view_get_paste_target_list(WebKitWebView* webView)
Link Here
|
1993 |
} |
2020 |
} |
1994 |
|
2021 |
|
1995 |
/** |
2022 |
/** |
|
|
2023 |
* webkit_web_view_can_show_mime_type: |
2024 |
* @web_view: a #WebKitWebView |
2025 |
* @mime_type: a MIME type |
2026 |
* |
2027 |
* This functions returns whether or not a MIME type can be displayed using this view. |
2028 |
* |
2029 |
* Return value: a #gboolean indicating if the MIME type can be displayed |
2030 |
**/ |
2031 |
|
2032 |
gboolean webkit_web_view_can_show_mime_type (WebKitWebView* webView, const gchar* mimeType) |
2033 |
{ |
2034 |
g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE); |
2035 |
|
2036 |
Frame* frame = core(webkit_web_view_get_main_frame(webView)); |
2037 |
if (FrameLoader* loader = frame->loader()) |
2038 |
return loader->canShowMIMEType(mimeType); |
2039 |
else |
2040 |
return FALSE; |
2041 |
} |
2042 |
|
2043 |
/** |
1996 |
* webkit_web_view_get_transparent: |
2044 |
* webkit_web_view_get_transparent: |
1997 |
* @web_view: a #WebKitWebView |
2045 |
* @web_view: a #WebKitWebView |
1998 |
* |
2046 |
* |