Changeset 41401 in webkit


Ignore:
Timestamp:
Mar 3, 2009 11:48:22 AM (15 years ago)
Author:
kov@webkit.org
Message:

2009-03-03 Gustavo Noronha Silva <Gustavo Noronha Silva>

Reviewed by Alexey Proskuryakov.

https://bugs.webkit.org/show_bug.cgi?id=16826
[Gtk] Implement WebKitDownload

Adding new files related to WebKitDownload to the GTK+ port.

  • GNUmakefile.am:

WebCore:

2009-03-03 Gustavo Noronha Silva <Gustavo Noronha Silva>

Reviewed by Alexey Proskuryakov.

https://bugs.webkit.org/show_bug.cgi?id=16826
[Gtk] Implement WebKitDownload

Make the Soup backend able to handle requests without a frame,
since we may have such things now that we support downloads.

  • platform/network/ResourceHandleInternal.h:
  • platform/network/soup/ResourceHandleSoup.cpp: (WebCore::ResourceHandle::start):

WebKit/gtk:

2009-03-03 Gustavo Noronha Silva <Gustavo Noronha Silva>

Reviewed by Alexey Proskuryakov.

https://bugs.webkit.org/show_bug.cgi?id=16826
[Gtk] Implement WebKitDownload

Implement download, and provide a nice object wrapping the
download process. Initial work done by Marco Barisione and
Pierre-Luc Beaudoin for Collabora.

  • WebCoreSupport/ContextMenuClientGtk.cpp: (WebKit::ContextMenuClient::downloadURL):
  • WebCoreSupport/FrameLoaderClientGtk.cpp: (WebKit::FrameLoaderClient::download): (WebKit::FrameLoaderClient::startDownload):
  • webkit/webkit.h:
  • webkit/webkitdefines.h:
  • webkit/webkitdownload.cpp: Added. (_WebKitDownloadPrivate::): (_WebKitDownloadPrivate::webkit_download_dispose): (_WebKitDownloadPrivate::webkit_download_finalize): (_WebKitDownloadPrivate::webkit_download_get_property): (_WebKitDownloadPrivate::webkit_download_set_property): (_WebKitDownloadPrivate::webkit_download_class_init): (_WebKitDownloadPrivate::webkit_download_init): (_WebKitDownloadPrivate::webkit_download_new): (_WebKitDownloadPrivate::webkit_download_open_stream_for_uri): (_WebKitDownloadPrivate::webkit_download_close_stream): (_WebKitDownloadPrivate::webkit_download_start): (_WebKitDownloadPrivate::webkit_download_cancel): (_WebKitDownloadPrivate::webkit_download_get_uri): (_WebKitDownloadPrivate::webkit_download_get_network_request): (_WebKitDownloadPrivate::webkit_download_set_response): (_WebKitDownloadPrivate::webkit_download_get_suggested_filename): (_WebKitDownloadPrivate::webkit_download_get_destination_uri): (_WebKitDownloadPrivate::webkit_download_set_destination_uri): (_WebKitDownloadPrivate::webkit_download_get_state): (_WebKitDownloadPrivate::webkit_download_get_total_size): (_WebKitDownloadPrivate::webkit_download_get_current_size): (_WebKitDownloadPrivate::webkit_download_get_progress): (_WebKitDownloadPrivate::webkit_download_get_elapsed_time): (_WebKitDownloadPrivate::webkit_download_received_data): (_WebKitDownloadPrivate::webkit_download_finished_loading): (_WebKitDownloadPrivate::webkit_download_error): (_WebKitDownloadPrivate::DownloadClient::DownloadClient): (_WebKitDownloadPrivate::DownloadClient::didReceiveResponse): (_WebKitDownloadPrivate::DownloadClient::didReceiveData): (_WebKitDownloadPrivate::DownloadClient::didFinishLoading): (_WebKitDownloadPrivate::DownloadClient::didFail): (_WebKitDownloadPrivate::DownloadClient::wasBlocked): (_WebKitDownloadPrivate::DownloadClient::cannotShowURL):
  • webkit/webkitdownload.h: Added.
  • webkit/webkitprivate.h:
  • webkit/webkitwebview.cpp:
  • webkitmarshal.list:
Location:
trunk
Files:
2 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r41357 r41401  
     12009-03-03  Gustavo Noronha Silva  <gns@gnome.org>
     2
     3        Reviewed by Alexey Proskuryakov.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=16826
     6        [Gtk] Implement WebKitDownload
     7
     8        Adding new files related to WebKitDownload to the GTK+ port.
     9
     10        * GNUmakefile.am:
     11
    1122009-03-02  Gustavo Noronha Silva  <gns@gnome.org>
    213
  • trunk/GNUmakefile.am

    r41357 r41401  
    305305        WebKit/gtk/webkit/webkit.h \
    306306        WebKit/gtk/webkit/webkitdefines.h \
     307        WebKit/gtk/webkit/webkitdownload.h \
    307308        WebKit/gtk/webkit/webkitnetworkrequest.h \
    308309        WebKit/gtk/webkit/webkitversion.h \
     
    349350        WebKit/gtk/webkit/webkitwebpolicydecision.cpp \
    350351        WebKit/gtk/webkit/webkitwebsettings.cpp \
     352        WebKit/gtk/webkit/webkitdownload.cpp \
    351353        WebKit/gtk/webkit/webkitwebview.cpp \
    352354        WebKit/gtk/webkit/webkitwebwindowfeatures.cpp
  • trunk/WebCore/ChangeLog

    r41399 r41401  
     12009-03-03  Gustavo Noronha Silva  <gns@gnome.org>
     2
     3        Reviewed by Alexey Proskuryakov.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=16826
     6        [Gtk] Implement WebKitDownload
     7
     8        Make the Soup backend able to handle requests without a frame,
     9        since we may have such things now that we support downloads.
     10
     11        * platform/network/ResourceHandleInternal.h:
     12        * platform/network/soup/ResourceHandleSoup.cpp:
     13        (WebCore::ResourceHandle::start):
     14
    1152009-03-03  Dimitri Glazkov  <dglazkov@chromium.org>
    216
  • trunk/WebCore/platform/network/soup/ResourceHandleSoup.cpp

    r41333 r41401  
    546546    ASSERT(!d->m_msg);
    547547
    548     // If we are no longer attached to a Page, this must be an attempted load from an
    549     // onUnload handler, so let's just block it.
    550     if (!frame->page())
     548
     549    // The frame could be null if the ResourceHandle is not associated to any
     550    // Frame, e.g. if we are downloading a file.
     551    // If the frame is not null but the page is null this must be an attempted
     552    // load from an onUnload handler, so let's just block it.
     553    if (frame && !frame->page())
    551554        return false;
    552555
  • trunk/WebKit/gtk/ChangeLog

    r41341 r41401  
     12009-03-03  Gustavo Noronha Silva  <gns@gnome.org>
     2
     3        Reviewed by Alexey Proskuryakov.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=16826
     6        [Gtk] Implement WebKitDownload
     7
     8        Implement download, and provide a nice object wrapping the
     9        download process. Initial work done by Marco Barisione and
     10        Pierre-Luc Beaudoin for Collabora.
     11
     12        * WebCoreSupport/ContextMenuClientGtk.cpp:
     13        (WebKit::ContextMenuClient::downloadURL):
     14        * WebCoreSupport/FrameLoaderClientGtk.cpp:
     15        (WebKit::FrameLoaderClient::download):
     16        (WebKit::FrameLoaderClient::startDownload):
     17        * webkit/webkit.h:
     18        * webkit/webkitdefines.h:
     19        * webkit/webkitdownload.cpp: Added.
     20        (_WebKitDownloadPrivate::):
     21        (_WebKitDownloadPrivate::webkit_download_dispose):
     22        (_WebKitDownloadPrivate::webkit_download_finalize):
     23        (_WebKitDownloadPrivate::webkit_download_get_property):
     24        (_WebKitDownloadPrivate::webkit_download_set_property):
     25        (_WebKitDownloadPrivate::webkit_download_class_init):
     26        (_WebKitDownloadPrivate::webkit_download_init):
     27        (_WebKitDownloadPrivate::webkit_download_new):
     28        (_WebKitDownloadPrivate::webkit_download_open_stream_for_uri):
     29        (_WebKitDownloadPrivate::webkit_download_close_stream):
     30        (_WebKitDownloadPrivate::webkit_download_start):
     31        (_WebKitDownloadPrivate::webkit_download_cancel):
     32        (_WebKitDownloadPrivate::webkit_download_get_uri):
     33        (_WebKitDownloadPrivate::webkit_download_get_network_request):
     34        (_WebKitDownloadPrivate::webkit_download_set_response):
     35        (_WebKitDownloadPrivate::webkit_download_get_suggested_filename):
     36        (_WebKitDownloadPrivate::webkit_download_get_destination_uri):
     37        (_WebKitDownloadPrivate::webkit_download_set_destination_uri):
     38        (_WebKitDownloadPrivate::webkit_download_get_state):
     39        (_WebKitDownloadPrivate::webkit_download_get_total_size):
     40        (_WebKitDownloadPrivate::webkit_download_get_current_size):
     41        (_WebKitDownloadPrivate::webkit_download_get_progress):
     42        (_WebKitDownloadPrivate::webkit_download_get_elapsed_time):
     43        (_WebKitDownloadPrivate::webkit_download_received_data):
     44        (_WebKitDownloadPrivate::webkit_download_finished_loading):
     45        (_WebKitDownloadPrivate::webkit_download_error):
     46        (_WebKitDownloadPrivate::DownloadClient::DownloadClient):
     47        (_WebKitDownloadPrivate::DownloadClient::didReceiveResponse):
     48        (_WebKitDownloadPrivate::DownloadClient::didReceiveData):
     49        (_WebKitDownloadPrivate::DownloadClient::didFinishLoading):
     50        (_WebKitDownloadPrivate::DownloadClient::didFail):
     51        (_WebKitDownloadPrivate::DownloadClient::wasBlocked):
     52        (_WebKitDownloadPrivate::DownloadClient::cannotShowURL):
     53        * webkit/webkitdownload.h: Added.
     54        * webkit/webkitprivate.h:
     55        * webkit/webkitwebview.cpp:
     56        * webkitmarshal.list:
     57
    1582009-03-01  Jan Michael Alonzo  <jmalonzo@webkit.org>
    259
  • trunk/WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp

    r37779 r41401  
    11/*
    22 *  Copyright (C) 2008 Nuanti Ltd.
     3 *  Copyright (C) 2009 Gustavo Noronha Silva <gns@gnome.org>
    34 *
    45 *  This library is free software; you can redistribute it and/or
     
    2122#include "ContextMenuClientGtk.h"
    2223
     24#include "CString.h"
    2325#include "HitTestResult.h"
    2426#include "KURL.h"
     
    164166void ContextMenuClient::downloadURL(const KURL& url)
    165167{
    166     notImplemented();
     168    WebKitNetworkRequest* network_request = webkit_network_request_new(url.string().utf8().data());
     169    WebKitDownload* download = webkit_download_new(network_request);
     170    g_object_unref(network_request);
     171
     172    gboolean handled;
     173    g_signal_emit_by_name(m_webView, "download-requested", download, &handled);
     174
     175    if (!handled) {
     176        webkit_download_cancel(download);
     177        g_object_unref(download);
     178        return;
     179    }
     180
     181    webkit_download_start(download);
    167182}
    168183
  • trunk/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp

    r41313 r41401  
    44 *  Copyright (C) 2007 Christian Dywan <christian@twotoasts.de>
    55 *  Copyright (C) 2008 Collabora Ltd.  All rights reserved.
     6 *  Copyright (C) 2009 Gustavo Noronha Silva <gns@gnome.org>
    67 *
    78 *  This library is free software; you can redistribute it and/or
     
    4344#include "PluginDatabase.h"
    4445#include "RenderPart.h"
     46#include "ResourceHandle.h"
    4547#include "ResourceRequest.h"
    4648#include "CString.h"
     
    775777}
    776778
    777 void FrameLoaderClient::download(ResourceHandle*, const ResourceRequest&, const ResourceRequest&, const ResourceResponse&)
    778 {
    779     notImplemented();
     779void FrameLoaderClient::download(ResourceHandle* handle, const ResourceRequest& request, const ResourceRequest&, const ResourceResponse&)
     780{
     781    // FIXME: We could reuse the same handle here, but when I tried
     782    // implementing that the main load would fail and stop, so I have
     783    // simplified this case for now.
     784    handle->cancel();
     785    startDownload(request);
    780786}
    781787
     
    863869}
    864870
    865 void FrameLoaderClient::startDownload(const ResourceRequest&)
    866 {
    867     notImplemented();
     871void FrameLoaderClient::startDownload(const ResourceRequest& request)
     872{
     873    WebKitNetworkRequest* networkRequest = webkit_network_request_new(request.url().string().utf8().data());
     874    WebKitDownload* download = webkit_download_new(networkRequest);
     875    g_object_unref(networkRequest);
     876
     877    WebKitWebView* view = getViewFromFrame(m_frame);
     878    gboolean handled;
     879    g_signal_emit_by_name(view, "download-requested", download, &handled);
     880
     881    if (!handled) {
     882        webkit_download_cancel(download);
     883        g_object_unref(download);
     884        return;
     885    }
     886
     887    webkit_download_start(download);
    868888}
    869889
  • trunk/WebKit/gtk/webkit/webkit.h

    r39421 r41401  
    2424#include <webkit/webkitversion.h>
    2525#include <webkit/webkitdefines.h>
     26#include <webkit/webkitdownload.h>
    2627#include <webkit/webkitnetworkrequest.h>
    2728#include <webkit/webkitwebframe.h>
  • trunk/WebKit/gtk/webkit/webkitdefines.h

    r39421 r41401  
    6969typedef struct _WebKitWebViewClass WebKitWebViewClass;
    7070
     71typedef struct _WebKitDownload WebKitDownload;
     72typedef struct _WebKitDownloadClass WebKitDownloadClass;
     73
    7174G_END_DECLS
    7275
  • trunk/WebKit/gtk/webkit/webkitprivate.h

    r41341 r41401  
    2929
    3030#include <webkit/webkitdefines.h>
     31#include <webkit/webkitdownload.h>
    3132#include <webkit/webkitwebview.h>
    3233#include <webkit/webkitwebframe.h>
     
    4445#include "InspectorClientGtk.h"
    4546#include "FrameLoaderClient.h"
     47#include "ResourceHandle.h"
     48#include "ResourceResponse.h"
    4649#include "WindowFeatures.h"
    4750
    4851#include <glib.h>
     52
     53class DownloadClient;
    4954
    5055namespace WebKit {
  • trunk/WebKit/gtk/webkit/webkitwebview.cpp

    r41337 r41401  
    2727#include "config.h"
    2828
     29#include "webkitdownload.h"
    2930#include "webkitwebview.h"
    3031#include "webkitenumtypes.h"
     
    135136    PASTE_CLIPBOARD,
    136137    CUT_CLIPBOARD,
     138    DOWNLOAD_REQUESTED,
    137139    LAST_SIGNAL
    138140};
     
    11161118            G_TYPE_POINTER,
    11171119            G_TYPE_POINTER);
     1120
     1121    /**
     1122     * WebKitWebView::download-requested:
     1123     * @web_view: the object on which the signal is emitted
     1124     * @download: the message text
     1125     * @return: TRUE if the download was handled.
     1126     *
     1127     * A new Download is being requested. By default, if the signal is
     1128     * not handled, the download is cancelled.
     1129     *
     1130     * Since: 1.1.2
     1131     */
     1132    webkit_web_view_signals[DOWNLOAD_REQUESTED] = g_signal_new("download-requested",
     1133            G_TYPE_FROM_CLASS(webViewClass),
     1134            (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
     1135            0,
     1136            g_signal_accumulator_true_handled,
     1137            NULL,
     1138            webkit_marshal_BOOLEAN__OBJECT,
     1139            G_TYPE_BOOLEAN, 1,
     1140            G_TYPE_OBJECT);
    11181141
    11191142    /**
  • trunk/WebKit/gtk/webkitmarshal.list

    r41251 r41401  
     1BOOLEAN:INT,INT,STRING
     2BOOLEAN:OBJECT
    13BOOLEAN:OBJECT,OBJECT,OBJECT,OBJECT
    24BOOLEAN:OBJECT,OBJECT,STRING,OBJECT
Note: See TracChangeset for help on using the changeset viewer.