Changeset 39421 in webkit


Ignore:
Timestamp:
Dec 19, 2008 7:18:31 PM (15 years ago)
Author:
zecke@webkit.org
Message:

2008-12-19 Marco Barisione <marco.barisione@collabora.co.uk>

Reviewed by Holger Freyther.

http://bugs.webkit.org/show_bug.cgi?id=16562
[gtk] Implement WebPolicyDelegate methods

Original work by Pierre-Luc Beaudoin. Final touches by Gustavo
Noronha.

This implements the delegates methods of WebPolicyDelegate.
Since Gtk+/C doesn't have delegate methods, they are replaced with
signals.

A new object WebKitWebPolicyDecision allows the browser to delay its
response in certain cases. WebKitWebNavigationAction contains the
information about what caused a navigation request.

  • WebCoreSupport/FrameLoaderClientGtk.cpp: (WebKit::FrameLoaderClient::FrameLoaderClient): (WebKit::FrameLoaderClient::~FrameLoaderClient): (WebKit::FrameLoaderClient::dispatchDecidePolicyForMIMEType): (WebKit::FrameLoaderClient::dispatchDecidePolicyForNewWindowAction): (WebKit::FrameLoaderClient::dispatchDecidePolicyForNavigationAction): (WebKit::FrameLoaderClient::cancelPolicyCheck): (WebKit::FrameLoaderClient::canShowMIMEType):
  • WebCoreSupport/FrameLoaderClientGtk.h:
  • webkit/webkit.h:
  • webkit/webkitdefines.h:
  • webkit/webkitprivate.cpp: (WebKit::kit): (WebKit::core):
  • webkit/webkitprivate.h:
  • webkit/webkitwebnavigationaction.cpp: Added. (_WebKitWebNavigationActionPrivate::): (_WebKitWebNavigationActionPrivate::webkit_web_navigation_action_get_property): (_WebKitWebNavigationActionPrivate::webkit_web_navigation_action_set_property): (_WebKitWebNavigationActionPrivate::webkit_web_navigation_action_init): (_WebKitWebNavigationActionPrivate::webkit_web_navigation_action_finalize): (_WebKitWebNavigationActionPrivate::webkit_web_navigation_action_class_init): (_WebKitWebNavigationActionPrivate::webkit_web_navigation_action_get_reason): (_WebKitWebNavigationActionPrivate::webkit_web_navigation_action_set_reason): (_WebKitWebNavigationActionPrivate::webkit_web_navigation_action_get_original_uri): (_WebKitWebNavigationActionPrivate::webkit_web_navigation_action_set_original_uri):
  • webkit/webkitwebnavigationaction.h: Added.
  • webkit/webkitwebpolicydecision.cpp: Added. (_WebKitWebPolicyDecisionPrivate::webkit_web_policy_decision_class_init): (_WebKitWebPolicyDecisionPrivate::webkit_web_policy_decision_init): (_WebKitWebPolicyDecisionPrivate::webkit_web_policy_decision_new): (_WebKitWebPolicyDecisionPrivate::webkit_web_policy_decision_use): (_WebKitWebPolicyDecisionPrivate::webkit_web_policy_decision_ignore): (_WebKitWebPolicyDecisionPrivate::webkit_web_policy_decision_download): (_WebKitWebPolicyDecisionPrivate::webkit_web_policy_decision_cancel):
  • webkit/webkitwebpolicydecision.h: Added.
Location:
trunk
Files:
4 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r39407 r39421  
     12008-12-19  Marco Barisione  <marco.barisione@collabora.co.uk>
     2
     3        Reviewed by Holger Freyther.
     4
     5        http://bugs.webkit.org/show_bug.cgi?id=16562
     6        [gtk] Implement WebPolicyDelegate methods
     7
     8        Original work by Pierre-Luc Beaudoin. Final touches by Gustavo
     9        Noronha.
     10
     11        This implements the delegates methods of WebPolicyDelegate.
     12        Since Gtk+/C doesn't have delegate methods, they are replaced with
     13        signals.
     14
     15        A new object WebKitWebPolicyDecision allows the browser to delay its
     16        response in certain cases. WebKitWebNavigationAction contains the
     17        information about what caused a navigation request.
     18
     19        * GNUmakefile.am: Add new files
     20
    1212008-12-19  Gustavo Noronha Silva  <gns@gnome.org>
    222
  • trunk/GNUmakefile.am

    r39241 r39421  
    309309        WebKit/gtk/webkit/webkitwebhistoryitem.h \
    310310        WebKit/gtk/webkit/webkitwebinspector.h \
     311        WebKit/gtk/webkit/webkitwebnavigationaction.h \
     312        WebKit/gtk/webkit/webkitwebpolicydecision.h \
    311313        WebKit/gtk/webkit/webkitwebsettings.h \
    312314        WebKit/gtk/webkit/webkitwebwindowfeatures.h \
     
    342344        WebKit/gtk/webkit/webkitwebhistoryitem.cpp \
    343345        WebKit/gtk/webkit/webkitwebinspector.cpp \
     346        WebKit/gtk/webkit/webkitwebnavigationaction.cpp \
     347        WebKit/gtk/webkit/webkitwebpolicydecision.cpp \
    344348        WebKit/gtk/webkit/webkitwebsettings.cpp \
    345349        WebKit/gtk/webkit/webkitwebview.cpp \
  • trunk/WebKit/gtk/ChangeLog

    r39393 r39421  
     12008-12-19  Marco Barisione  <marco.barisione@collabora.co.uk>
     2
     3        Reviewed by Holger Freyther.
     4
     5        http://bugs.webkit.org/show_bug.cgi?id=16562
     6        [gtk] Implement WebPolicyDelegate methods
     7
     8        Original work by Pierre-Luc Beaudoin. Final touches by Gustavo
     9        Noronha.
     10
     11        This implements the delegates methods of WebPolicyDelegate.
     12        Since Gtk+/C doesn't have delegate methods, they are replaced with
     13        signals.
     14
     15        A new object WebKitWebPolicyDecision allows the browser to delay its
     16        response in certain cases. WebKitWebNavigationAction contains the
     17        information about what caused a navigation request.
     18
     19        * WebCoreSupport/FrameLoaderClientGtk.cpp:
     20        (WebKit::FrameLoaderClient::FrameLoaderClient):
     21        (WebKit::FrameLoaderClient::~FrameLoaderClient):
     22        (WebKit::FrameLoaderClient::dispatchDecidePolicyForMIMEType):
     23        (WebKit::FrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
     24        (WebKit::FrameLoaderClient::dispatchDecidePolicyForNavigationAction):
     25        (WebKit::FrameLoaderClient::cancelPolicyCheck):
     26        (WebKit::FrameLoaderClient::canShowMIMEType):
     27        * WebCoreSupport/FrameLoaderClientGtk.h:
     28        * webkit/webkit.h:
     29        * webkit/webkitdefines.h:
     30        * webkit/webkitprivate.cpp:
     31        (WebKit::kit):
     32        (WebKit::core):
     33        * webkit/webkitprivate.h:
     34        * webkit/webkitwebnavigationaction.cpp: Added.
     35        (_WebKitWebNavigationActionPrivate::):
     36        (_WebKitWebNavigationActionPrivate::webkit_web_navigation_action_get_property):
     37        (_WebKitWebNavigationActionPrivate::webkit_web_navigation_action_set_property):
     38        (_WebKitWebNavigationActionPrivate::webkit_web_navigation_action_init):
     39        (_WebKitWebNavigationActionPrivate::webkit_web_navigation_action_finalize):
     40        (_WebKitWebNavigationActionPrivate::webkit_web_navigation_action_class_init):
     41        (_WebKitWebNavigationActionPrivate::webkit_web_navigation_action_get_reason):
     42        (_WebKitWebNavigationActionPrivate::webkit_web_navigation_action_set_reason):
     43        (_WebKitWebNavigationActionPrivate::webkit_web_navigation_action_get_original_uri):
     44        (_WebKitWebNavigationActionPrivate::webkit_web_navigation_action_set_original_uri):
     45        * webkit/webkitwebnavigationaction.h: Added.
     46        * webkit/webkitwebpolicydecision.cpp: Added.
     47        (_WebKitWebPolicyDecisionPrivate::webkit_web_policy_decision_class_init):
     48        (_WebKitWebPolicyDecisionPrivate::webkit_web_policy_decision_init):
     49        (_WebKitWebPolicyDecisionPrivate::webkit_web_policy_decision_new):
     50        (_WebKitWebPolicyDecisionPrivate::webkit_web_policy_decision_use):
     51        (_WebKitWebPolicyDecisionPrivate::webkit_web_policy_decision_ignore):
     52        (_WebKitWebPolicyDecisionPrivate::webkit_web_policy_decision_download):
     53        (_WebKitWebPolicyDecisionPrivate::webkit_web_policy_decision_cancel):
     54        * webkit/webkitwebpolicydecision.h: Added.
     55        * webkit/webkitwebview.cpp:
     56        * webkit/webkitwebview.h:
     57
    1582008-12-18  Dan Bernstein  <mitz@apple.com>
    259
  • trunk/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp

    r39393 r39421  
    4747#include "webkitnetworkrequest.h"
    4848#include "webkitwebframe.h"
     49#include "webkitwebnavigationaction.h"
     50#include "webkitwebpolicydecision.h"
    4951#include "webkitprivate.h"
    5052
     
    6264    : m_frame(frame)
    6365    , m_userAgent("")
     66    , m_policyDecision(0)
    6467    , m_pluginView(0)
    6568    , m_hasSentResponseToPlugin(false)
    6669{
    6770    ASSERT(m_frame);
     71}
     72
     73FrameLoaderClient::~FrameLoaderClient()
     74{
     75    if (m_policyDecision)
     76        g_object_unref(m_policyDecision);
    6877}
    6978
     
    251260}
    252261
    253 void FrameLoaderClient::dispatchDecidePolicyForMIMEType(FramePolicyFunction policyFunction, const String&, const ResourceRequest&)
    254 {
    255     // FIXME: we need to call directly here (comment copied from Qt version)
     262void FrameLoaderClient::dispatchDecidePolicyForMIMEType(FramePolicyFunction policyFunction, const String& mimeType, const ResourceRequest& resourceRequest)
     263{
    256264    ASSERT(policyFunction);
    257265    if (!policyFunction)
    258266        return;
    259     (core(m_frame)->loader()->*policyFunction)(PolicyUse);
    260 }
    261 
    262 void FrameLoaderClient::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction policyFunction, const NavigationAction&, const ResourceRequest&, PassRefPtr<FormState>, const String&)
     267
     268    WebKitWebView* page = getViewFromFrame(m_frame);
     269    WebKitNetworkRequest* request = webkit_network_request_new(resourceRequest.url().string().utf8().data());
     270
     271    WebKitWebPolicyDecision* policyDecision = webkit_web_policy_decision_new(m_frame, policyFunction);
     272    if (m_policyDecision)
     273        g_object_unref(m_policyDecision);
     274    m_policyDecision = policyDecision;
     275
     276    gboolean isHandled = false;
     277    g_signal_emit_by_name(page, "mime-type-policy-decision-requested", m_frame, request, mimeType.utf8().data(), policyDecision, &isHandled);
     278
     279    g_object_unref(request);
     280
     281    if (isHandled)
     282        return;
     283
     284    if (canShowMIMEType(mimeType))
     285        webkit_web_policy_decision_use (policyDecision);
     286    else
     287        webkit_web_policy_decision_download (policyDecision);
     288}
     289
     290void FrameLoaderClient::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction policyFunction, const NavigationAction& action, const ResourceRequest& resourceRequest, PassRefPtr<FormState>, const String& s)
    263291{
    264292    ASSERT(policyFunction);
     
    279307    WebKitNetworkRequest* request = webkit_network_request_new(resourceRequest.url().string().utf8().data());
    280308    WebKitNavigationResponse response;
    281 
     309    /*
     310     * We still support the deprecated navigation-requested signal, if the
     311     * application doesn't ignore the navigation then the new signal is
     312     * emitted.
     313     * navigation-policy-decision-requested must be emitted after
     314     * navigation-requested as the policy decision can be async.
     315     */
    282316    g_signal_emit_by_name(webView, "navigation-requested", m_frame, request, &response);
    283 
    284     g_object_unref(request);
    285317
    286318    if (response == WEBKIT_NAVIGATION_RESPONSE_IGNORE) {
    287319        (core(m_frame)->loader()->*policyFunction)(PolicyIgnore);
     320        g_object_unref(request);
    288321        return;
    289322    }
    290323
    291     (core(m_frame)->loader()->*policyFunction)(PolicyUse);
     324    WebKitWebPolicyDecision* policyDecision = webkit_web_policy_decision_new(m_frame, policyFunction);
     325    if (m_policyDecision)
     326        g_object_unref(m_policyDecision);
     327    m_policyDecision = policyDecision;
     328
     329    // TODO: use action.event().
     330    GObject* navigationAction = G_OBJECT(g_object_new(WEBKIT_TYPE_WEB_NAVIGATION_ACTION,
     331                                                     "reason", kit(action.type()),
     332                                                      "original-uri", action.url().string().utf8().data(),
     333                                                      NULL));
     334
     335    gboolean isHandled = false;
     336    g_signal_emit_by_name(webView, "navigation-policy-decision-requested", m_frame, request, navigationAction, policyDecision, &isHandled);
     337
     338    g_object_unref(navigationAction);
     339    g_object_unref(request);
     340
     341    // FIXME Implement default behavior when we can query the backend what protocols it supports
     342    if (!isHandled)
     343        webkit_web_policy_decision_use(m_policyDecision);
    292344}
    293345
     
    563615void FrameLoaderClient::cancelPolicyCheck()
    564616{
    565     notImplemented();
     617    //FIXME Add support for more than one policy decision at once
     618    if (m_policyDecision)
     619        webkit_web_policy_decision_cancel(m_policyDecision);
    566620}
    567621
     
    592646}
    593647
    594 bool FrameLoaderClient::canShowMIMEType(const String&) const
    595 {
    596     notImplemented();
    597     return true;
     648bool FrameLoaderClient::canShowMIMEType(const String& type) const
     649{
     650    return MIMETypeRegistry::isSupportedImageMIMEType(type) || MIMETypeRegistry::isSupportedNonImageMIMEType(type) ||
     651        PluginDatabase::installedPlugins()->isMIMETypeRegistered(type);
    598652}
    599653
  • trunk/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h

    r39393 r39421  
    3434#include "ResourceResponse.h"
    3535#include "PluginView.h"
     36#include "webkitwebpolicydecision.h"
    3637
    3738typedef struct _WebKitWebFrame WebKitWebFrame;
     
    4243    public:
    4344        FrameLoaderClient(WebKitWebFrame*);
    44         virtual ~FrameLoaderClient() { }
     45        virtual ~FrameLoaderClient();
    4546        virtual void frameLoaderDestroyed();
    4647
     
    173174        WebCore::ResourceResponse m_response;
    174175        WebCore::String m_userAgent;
     176        WebKitWebPolicyDecision* m_policyDecision;
    175177
    176178        // Plugin view to redirect data to
  • trunk/WebKit/gtk/webkit/webkit.h

    r38834 r39421  
    11/*
    22 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
     3 * Copyright (C) 2008 Collabora Ltd.
    34 *
    45 * This library is free software; you can redistribute it and/or
     
    3132#include <webkit/webkitwebbackforwardlist.h>
    3233#include <webkit/webkitwebhistoryitem.h>
     34#include <webkit/webkitwebpolicydecision.h>
     35#include <webkit/webkitwebnavigationaction.h>
    3336#include <webkit/webkitenumtypes.h>
    3437
  • trunk/WebKit/gtk/webkit/webkitdefines.h

    r38834 r39421  
    11/*
    22 * Copyright (C) 2007 Holger Hans Peter Freyther
     3 * Copyright (C) 2008 Collabora Ltd.
    34 *
    45 * This library is free software; you can redistribute it and/or
     
    5354typedef struct _WebKitWebFrameClass WebKitWebFrameClass;
    5455
     56typedef struct _WebKitWebPolicyDecision WebKitWebPolicyDecision;
     57typedef struct _WebKitWebPolicyDecisionClass WebKitWebPolicyDecisionClass;
     58
    5559typedef struct _WebKitWebSettings WebKitWebSettings;
    5660typedef struct _WebKitWebSettingsClass WebKitWebSettingsClass;
  • trunk/WebKit/gtk/webkit/webkitprivate.cpp

    r38087 r39421  
    11/*
    22 * Copyright (C) 2007 Holger Hans Peter Freyther
     3 * Copyright (C) 2008 Collabora Ltd.
    34 *
    45 * This library is free software; you can redistribute it and/or
     
    8485}
    8586
     87WebKitWebNavigationReason kit(WebCore::NavigationType type)
     88{
     89    return (WebKitWebNavigationReason)type;
     90}
     91
     92WebCore::NavigationType core(WebKitWebNavigationReason type)
     93{
     94    return (WebCore::NavigationType)type;
     95}
     96
    8697} /** end namespace WebKit */
    8798
  • trunk/WebKit/gtk/webkit/webkitprivate.h

    r39274 r39421  
    22 * Copyright (C) 2007, 2008 Holger Hans Peter Freyther
    33 * Copyright (C) 2008 Jan Michael C. Alonzo
     4 * Copyright (C) 2008 Collabora Ltd.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3031#include <webkit/webkitwebview.h>
    3132#include <webkit/webkitwebframe.h>
     33#include <webkit/webkitwebpolicydecision.h>
     34#include <webkit/webkitwebnavigationaction.h>
    3235#include <webkit/webkitwebsettings.h>
    3336#include <webkit/webkitwebwindowfeatures.h>
     
    5861
    5962    WebCore::BackForwardList* core(WebKitWebBackForwardList*);
     63
     64    WebKitWebNavigationReason kit(WebCore::NavigationType type);
     65    WebCore::NavigationType core(WebKitWebNavigationReason reason);
    6066}
    6167
     
    131137    webkit_web_view_notify_ready (WebKitWebView* web_view);
    132138
     139    WebKitWebPolicyDecision*
     140    webkit_web_policy_decision_new (WebKitWebFrame*, WebCore::FramePolicyFunction);
     141
     142    void
     143    webkit_web_policy_decision_cancel (WebKitWebPolicyDecision* decision);
     144
    133145    // FIXME: Move these to webkitwebframe.h once their API has been discussed.
    134146
  • trunk/WebKit/gtk/webkit/webkitwebview.cpp

    r39223 r39421  
    2727
    2828#include "webkitwebview.h"
     29#include "webkitenumtypes.h"
    2930#include "webkitmarshal.h"
    3031#include "webkitprivate.h"
     
    7677    /* normal signals */
    7778    NAVIGATION_REQUESTED,
     79    NAVIGATION_POLICY_DECISION_REQUESTED,
     80    MIME_TYPE_POLICY_DECISION_REQUESTED,
    7881    CREATE_WEB_VIEW,
    7982    WEB_VIEW_READY,
     
    632635}
    633636
    634 static WebKitNavigationResponse webkit_web_view_real_navigation_requested(WebKitWebView*, WebKitWebFrame* frame, WebKitNetworkRequest*)
    635 {
    636     notImplemented();
     637static WebKitNavigationResponse webkit_web_view_real_navigation_requested(WebKitWebView*, WebKitWebFrame*, WebKitNetworkRequest*)
     638{
    637639    return WEBKIT_NAVIGATION_RESPONSE_ACCEPT;
    638640}
     
    812814static gboolean webkit_navigation_request_handled(GSignalInvocationHint* ihint, GValue* returnAccu, const GValue* handlerReturn, gpointer dummy)
    813815{
    814     int signalHandled = g_value_get_int(handlerReturn);
    815     g_value_set_int(returnAccu, signalHandled);
    816 
    817     if (signalHandled != WEBKIT_NAVIGATION_RESPONSE_ACCEPT)
     816    WebKitNavigationResponse navigationResponse = (WebKitNavigationResponse)g_value_get_enum(handlerReturn);
     817    g_value_set_enum(returnAccu, navigationResponse);
     818
     819    if (navigationResponse != WEBKIT_NAVIGATION_RESPONSE_ACCEPT)
    818820        return FALSE;
    819821
     
    908910            G_TYPE_BOOLEAN, 0);
    909911
     912    /**
     913     * WebKitWebView::navigation-requested:
     914     * @web_view: the object on which the signal is emitted
     915     * @frame: the #WebKitWebFrame that required the navigation
     916     * @request: a #WebKitNetworkRequest
     917     * @return: a WebKitNavigationResponse
     918     *
     919     * Emitted when @frame requests a navigation to another page.
     920     *
     921     * Deprecated: Use WebKitWebView::navigation-policy-decision-requested
     922     * instead
     923     */
    910924    webkit_web_view_signals[NAVIGATION_REQUESTED] = g_signal_new("navigation-requested",
    911925            G_TYPE_FROM_CLASS(webViewClass),
     
    914928            webkit_navigation_request_handled,
    915929            NULL,
    916             webkit_marshal_INT__OBJECT_OBJECT,
    917             G_TYPE_INT, 2,
    918             G_TYPE_OBJECT,
    919             G_TYPE_OBJECT);
     930            webkit_marshal_ENUM__OBJECT_OBJECT,
     931            WEBKIT_TYPE_NAVIGATION_RESPONSE, 2,
     932            WEBKIT_TYPE_WEB_FRAME,
     933            WEBKIT_TYPE_NETWORK_REQUEST);
     934
     935    /**
     936     * WebKitWebView::navigation-policy-decision-requested:
     937     * @web_view: the object on which the signal is emitted
     938     * @frame: the #WebKitWebFrame that required the navigation
     939     * @request: a #WebKitNetworkRequest
     940     * @navigation_action: a #WebKitWebNavigation
     941     * @policy_decision: a #WebKitWebPolicyDecision
     942     * @return: TRUE if the signal will be handled, FALSE to have the
     943     *          default behavior apply
     944     *
     945     * Emitted when @frame requests a navigation to another page.
     946     * If this signal is not handled, the default behavior is to allow the
     947     * navigation.
     948     *
     949     * Since: 1.0.3
     950     */
     951    webkit_web_view_signals[NAVIGATION_POLICY_DECISION_REQUESTED] = g_signal_new("navigation-policy-decision-requested",
     952            G_TYPE_FROM_CLASS(webViewClass),
     953            (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
     954            0,
     955            g_signal_accumulator_true_handled,
     956            NULL,
     957            webkit_marshal_BOOLEAN__OBJECT_OBJECT_OBJECT_OBJECT,
     958            G_TYPE_BOOLEAN, 4,
     959            WEBKIT_TYPE_WEB_FRAME,
     960            WEBKIT_TYPE_NETWORK_REQUEST,
     961            WEBKIT_TYPE_WEB_NAVIGATION_ACTION,
     962            WEBKIT_TYPE_WEB_POLICY_DECISION);
     963
     964    /**
     965     * WebKitWebView::mime-type-policy-decision-requested:
     966     * @web_view: the object on which the signal is emitted
     967     * @frame: the #WebKitWebFrame that required the policy decision
     968     * @request: a WebKitNetworkRequest
     969     * @mimetype: the MIME type attempted to load
     970     * @policy_decision: a #WebKitWebPolicyDecision
     971     * @return: TRUE if the signal will be handled, FALSE to have the
     972     *          default behavior apply
     973     *
     974     * Decide whether or not to display the given MIME type.  If this
     975     * signal is not handled, the default behavior is to show the
     976     * content of the requested URI if WebKit can show this MIME
     977     * type; if WebKit is not able to show the MIME type nothing
     978     * happens.
     979     *
     980     * Since: 1.0.3
     981     */
     982    webkit_web_view_signals[MIME_TYPE_POLICY_DECISION_REQUESTED] = g_signal_new("mime-type-policy-decision-requested",
     983            G_TYPE_FROM_CLASS(webViewClass),
     984            (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
     985            0,
     986            g_signal_accumulator_true_handled,
     987            NULL,
     988            webkit_marshal_BOOLEAN__OBJECT_OBJECT_STRING_OBJECT,
     989            G_TYPE_BOOLEAN, 4,
     990            WEBKIT_TYPE_WEB_FRAME,
     991            WEBKIT_TYPE_NETWORK_REQUEST,
     992            G_TYPE_STRING,
     993            WEBKIT_TYPE_WEB_POLICY_DECISION);
    920994
    921995    /**
     
    23162390
    23172391/**
     2392 * webkit_web_view_can_show_mime_type:
     2393 * @web_view: a #WebKitWebView
     2394 * @mime_type: a MIME type
     2395 *
     2396 * This functions returns whether or not a MIME type can be displayed using this view.
     2397 *
     2398 * Return value: a #gboolean indicating if the MIME type can be displayed
     2399 *
     2400 * Since: 1.0.3
     2401 **/
     2402
     2403gboolean webkit_web_view_can_show_mime_type(WebKitWebView* webView, const gchar* mimeType)
     2404{
     2405    g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE);
     2406
     2407    Frame* frame = core(webkit_web_view_get_main_frame(webView));
     2408    if (FrameLoader* loader = frame->loader())
     2409        return loader->canShowMIMEType(String::fromUTF8(mimeType));
     2410    else
     2411        return FALSE;
     2412}
     2413
     2414/**
    23182415 * webkit_web_view_get_transparent:
    23192416 * @web_view: a #WebKitWebView
  • trunk/WebKit/gtk/webkit/webkitwebview.h

    r39223 r39421  
    22 * Copyright (C) 2007 Holger Hans Peter Freyther
    33 * Copyright (C) 2007, 2008 Alp Toker <alp@atoker.com>
     4 * Copyright (C) 2008 Collabora Ltd.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    7273    gboolean                   (* web_view_ready)          (WebKitWebView* web_view);
    7374
    74     /*
    75      * TODO: FIXME: Create something like WebPolicyDecisionListener_Protocol instead
    76      */
    7775    WebKitNavigationResponse   (* navigation_requested)   (WebKitWebView        *web_view,
    7876                                                           WebKitWebFrame       *frame,
     
    257255
    258256WEBKIT_API gboolean
     257webkit_web_view_can_show_mime_type              (WebKitWebView        *web_view,
     258                                                 const gchar          *mime_type);
     259
     260WEBKIT_API gboolean
    259261webkit_web_view_get_transparent                 (WebKitWebView        *web_view);
    260262
Note: See TracChangeset for help on using the changeset viewer.