webengine/osswebengine/WebKit/qt/Api/qwebobjectpluginconnector.cpp
changeset 0 dd21522fd290
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2   Copyright (C) 2007 Trolltech ASA
       
     3   
       
     4   This library is free software; you can redistribute it and/or
       
     5   modify it under the terms of the GNU Library General Public
       
     6   License as published by the Free Software Foundation; either
       
     7   version 2 of the License, or (at your option) any later version.
       
     8   
       
     9   This library is distributed in the hope that it will be useful,
       
    10   but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    12   Library General Public License for more details.
       
    13   
       
    14   You should have received a copy of the GNU Library General Public License
       
    15   along with this library; see the file COPYING.LIB.  If not, write to
       
    16   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
       
    17   Boston, MA 02110-1301, USA.
       
    18   
       
    19   This class provides all functionality needed for loading images, style sheets and html
       
    20   pages from the web. It has a memory cache for these objects.
       
    21 */
       
    22 #include "qwebobjectpluginconnector.h"
       
    23 #include "qwebnetworkinterface.h"
       
    24 #include "qwebnetworkinterface_p.h"
       
    25 #include "qwebframe.h"
       
    26 #include "qwebpage.h"
       
    27 
       
    28 struct QWebObjectPluginConnectorPrivate
       
    29 {
       
    30     QWebFrame *frame;
       
    31 };
       
    32 
       
    33 QWebObjectPluginConnector::QWebObjectPluginConnector(QWebFrame *frame)
       
    34 {
       
    35     d = new QWebObjectPluginConnectorPrivate;
       
    36     d->frame = frame;
       
    37 }
       
    38 
       
    39 QWebFrame *QWebObjectPluginConnector::frame() const
       
    40 {
       
    41     return d->frame;
       
    42 }
       
    43 
       
    44 QWidget *QWebObjectPluginConnector::pluginParentWidget() const
       
    45 {
       
    46     return d->frame->page();
       
    47 }
       
    48 
       
    49 QWebNetworkJob *QWebObjectPluginConnector::requestUrl(const QWebNetworkRequest &request, Target target)
       
    50 {
       
    51     if (target != Plugin)
       
    52         return 0;
       
    53 
       
    54     QWebNetworkJob *job = new QWebNetworkJob;
       
    55     QWebNetworkJobPrivate *p = job->d;
       
    56     p->interface = d->frame->page()->networkInterface();
       
    57     p->connector = this;
       
    58 
       
    59     p->request = *request.d;
       
    60 
       
    61     d->frame->page()->networkInterface()->addJob(job);
       
    62     return job;
       
    63 }