⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 101188 in webkit


Ignore:
Timestamp:
Nov 25, 2011, 11:17:59 PM (15 years ago)
Author:
caio.oliveira@openbossa.org
Message:

[Qt] [WK2] Remove WebContext related code from QtWebPageProxy
https://bugs.webkit.org/show_bug.cgi?id=73150

Reviewed by Kenneth Rohde Christiansen.

Creates a QtWebContext class that abstracts away from QtWebPageProxy the
handling of creating / maintaining the default WebContext, as well as the
code for the WKContextRef clients.

Another motivation for having this entity is to have a proper place to add
objects are bound to the context, like the QtDownloadManager.

  • Target.pri:
  • UIProcess/qt/ClientImpl.cpp: Removed.
  • UIProcess/qt/ClientImpl.h: Removed.
  • UIProcess/qt/QtDownloadManager.cpp:
  • UIProcess/qt/QtWebContext.cpp: Added.

(WebKit::QtWebContext::QtWebContext):
(WebKit::QtWebContext::~QtWebContext):
(WebKit::QtWebContext::create):
(WebKit::QtWebContext::defaultContext):
(WebKit::QtWebContext::createWebPage):
(WebKit::QtWebContext::setNavigatorQtObjectEnabled):
(WebKit::QtWebContext::postMessageToNavigatorQtObject):
(WebKit::QtWebContext::initialize):
(WebKit::QtWebContext::initializeContextInjectedBundleClient):
(WebKit::toQtWebContext):
(WebKit::QtWebContext::didReceiveMessageFromInjectedBundle):

  • UIProcess/qt/QtWebContext.h: Added.

(WebKit::QtWebContext::downloadManager):

  • UIProcess/qt/QtWebPageProxy.cpp:

(QtWebPageProxy::QtWebPageProxy):
(QtWebPageProxy::~QtWebPageProxy):
(QtWebPageProxy::setNavigatorQtObjectEnabled):
(QtWebPageProxy::postMessageToNavigatorQtObject):
(QtWebPageProxy::handleDownloadRequest):

  • UIProcess/qt/QtWebPageProxy.h:
Location:
trunk/Source/WebKit2
Files:
2 added
2 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r101179 r101188  
     12011-11-25  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
     2
     3        [Qt] [WK2] Remove WebContext related code from QtWebPageProxy
     4        https://bugs.webkit.org/show_bug.cgi?id=73150
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        Creates a QtWebContext class that abstracts away from QtWebPageProxy the
     9        handling of creating / maintaining the default WebContext, as well as the
     10        code for the WKContextRef clients.
     11
     12        Another motivation for having this entity is to have a proper place to add
     13        objects are bound to the context, like the QtDownloadManager.
     14
     15        * Target.pri:
     16        * UIProcess/qt/ClientImpl.cpp: Removed.
     17        * UIProcess/qt/ClientImpl.h: Removed.
     18        * UIProcess/qt/QtDownloadManager.cpp:
     19        * UIProcess/qt/QtWebContext.cpp: Added.
     20        (WebKit::QtWebContext::QtWebContext):
     21        (WebKit::QtWebContext::~QtWebContext):
     22        (WebKit::QtWebContext::create):
     23        (WebKit::QtWebContext::defaultContext):
     24        (WebKit::QtWebContext::createWebPage):
     25        (WebKit::QtWebContext::setNavigatorQtObjectEnabled):
     26        (WebKit::QtWebContext::postMessageToNavigatorQtObject):
     27        (WebKit::QtWebContext::initialize):
     28        (WebKit::QtWebContext::initializeContextInjectedBundleClient):
     29        (WebKit::toQtWebContext):
     30        (WebKit::QtWebContext::didReceiveMessageFromInjectedBundle):
     31        * UIProcess/qt/QtWebContext.h: Added.
     32        (WebKit::QtWebContext::downloadManager):
     33        * UIProcess/qt/QtWebPageProxy.cpp:
     34        (QtWebPageProxy::QtWebPageProxy):
     35        (QtWebPageProxy::~QtWebPageProxy):
     36        (QtWebPageProxy::setNavigatorQtObjectEnabled):
     37        (QtWebPageProxy::postMessageToNavigatorQtObject):
     38        (QtWebPageProxy::handleDownloadRequest):
     39        * UIProcess/qt/QtWebPageProxy.h:
     40
    1412011-11-25  Jesus Sanchez-Palencia  <jesus.palencia@openbossa.org>
    242
  • trunk/Source/WebKit2/Target.pri

    r101164 r101188  
    314314    UIProcess/WebResourceLoadClient.h \
    315315    UIProcess/WebUIClient.h \
    316     UIProcess/qt/ClientImpl.h \
     316    UIProcess/qt/QtWebContext.h \
    317317    UIProcess/qt/QtWebPageEventHandler.h \
    318318    UIProcess/qt/QtGestureRecognizer.h \
     
    618618    UIProcess/WebResourceLoadClient.cpp \
    619619    UIProcess/WebUIClient.cpp \
    620     UIProcess/qt/ClientImpl.cpp \
     620    UIProcess/qt/QtWebContext.cpp \
    621621    UIProcess/qt/LayerTreeHostProxyQt.cpp \
    622622    UIProcess/qt/QtWebPageEventHandler.cpp \
  • trunk/Source/WebKit2/UIProcess/qt/QtDownloadManager.cpp

    r101136 r101188  
    2222#include "QtDownloadManager.h"
    2323
    24 #include "ClientImpl.h"
    2524#include "DownloadProxy.h"
    2625#include "QtWebError.h"
  • trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp

    r101164 r101188  
    3333#include "qwebpreferences_p_p.h"
    3434
    35 #include "ClientImpl.h"
    3635#include "DownloadProxy.h"
    3736#include "DrawingAreaProxyImpl.h"
     
    4039#include "FindIndicator.h"
    4140#include "LocalizedStrings.h"
    42 #include "MutableArray.h"
    4341#include "NotImplemented.h"
     42#include "QtDownloadManager.h"
    4443#include "QtWebPageEventHandler.h"
    4544#include "QtWebUndoCommand.h"
     
    6968using namespace WebCore;
    7069
    71 RefPtr<WebContext> QtWebPageProxy::s_defaultContext;
    72 RefPtr<QtDownloadManager> QtWebPageProxy::s_downloadManager;
    73 
    74 unsigned QtWebPageProxy::s_defaultPageProxyCount = 0;
    75 
    76 PassRefPtr<WebContext> QtWebPageProxy::defaultWKContext()
    77 {
    78     if (!s_defaultContext) {
    79         s_defaultContext = WebContext::create(String());
    80         setupContextInjectedBundleClient(toAPI(s_defaultContext.get()));
    81         s_downloadManager = QtDownloadManager::create(s_defaultContext.get());
    82     }
    83     return s_defaultContext;
    84 }
    85 
    8670QtWebPageProxy::QtWebPageProxy(QQuickWebPage* qmlWebPage, QQuickWebView* qmlWebView, WKContextRef contextRef, WKPageGroupRef pageGroupRef)
    8771    : m_qmlWebPage(qmlWebPage)
    8872    , m_qmlWebView(qmlWebView)
    89     , m_context(contextRef ? toImpl(contextRef) : defaultWKContext())
     73    , m_context(contextRef ? QtWebContext::create(toImpl(contextRef)) : QtWebContext::defaultContext())
    9074    , m_undoStack(adoptPtr(new QUndoStack(this)))
    9175    , m_navigatorQtObjectEnabled(false)
     
    9377    m_webPageProxy = m_context->createWebPage(this, toImpl(pageGroupRef));
    9478    m_history = QWKHistoryPrivate::createHistory(this, m_webPageProxy->backForwardList());
    95     if (!contextRef)
    96         s_defaultPageProxyCount++;
    9779}
    9880
     
    10688{
    10789    m_webPageProxy->close();
    108     // The context is the default one and we're deleting the last QtWebPageProxy.
    109     if (m_context == s_defaultContext) {
    110         ASSERT(s_defaultPageProxyCount > 0);
    111         s_defaultPageProxyCount--;
    112         if (!s_defaultPageProxyCount) {
    113             s_defaultContext.clear();
    114             s_downloadManager.clear();
    115         }
    116     }
    11790    delete m_history;
    11891}
     
    424397void QtWebPageProxy::setNavigatorQtObjectEnabled(bool enabled)
    425398{
    426     static String messageName("SetNavigatorQtObjectEnabled");
    427 
    428399    ASSERT(enabled != m_navigatorQtObjectEnabled);
    429400    // FIXME: Currently we have to keep this information in both processes and the setting is asynchronous.
    430401    m_navigatorQtObjectEnabled = enabled;
    431     RefPtr<MutableArray> body = MutableArray::create();
    432     body->append(m_webPageProxy.get());
    433     RefPtr<WebBoolean> webEnabled = WebBoolean::create(enabled);
    434     body->append(webEnabled.get());
    435     m_context->postMessageToInjectedBundle(messageName, body.get());
     402    m_context->setNavigatorQtObjectEnabled(m_webPageProxy.get(), enabled);
    436403}
    437404
    438405void QtWebPageProxy::postMessageToNavigatorQtObject(const QString& message)
    439406{
    440     static String messageName("MessageToNavigatorQtObject");
    441 
    442     RefPtr<MutableArray> body = MutableArray::create();
    443     body->append(m_webPageProxy.get());
    444     RefPtr<WebString> contents = WebString::create(String(message));
    445     body->append(contents.get());
    446     m_context->postMessageToInjectedBundle(messageName, body.get());
     407    m_context->postMessageToNavigatorQtObject(m_webPageProxy.get(), message);
    447408}
    448409
     
    551512
    552513    connect(downloadItem->d, SIGNAL(receivedResponse(QWebDownloadItem*)), this, SLOT(didReceiveDownloadResponse(QWebDownloadItem*)));
    553     s_downloadManager->addDownload(download, downloadItem);
     514    m_context->downloadManager()->addDownload(download, downloadItem);
    554515}
    555516
  • trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.h

    r101164 r101188  
    2525#include "LayerTreeContext.h"
    2626#include "PageClient.h"
    27 #include "QtDownloadManager.h"
     27#include "QtWebContext.h"
    2828#include "ShareableBitmap.h"
    2929#include "ViewportArguments.h"
    30 #include "WebContext.h"
    3130#include "WebPageProxy.h"
    3231#include <wtf/RefPtr.h>
     
    3938QT_END_NAMESPACE
    4039
     40class QQuickWebPage;
     41class QQuickWebView;
     42class QtWebError;
    4143class QtWebPageEventHandler;
    42 class QtWebError;
     44class QWebDownloadItem;
    4345class QWebPreferences;
    4446class QWKHistory;
    45 class QQuickWebPage;
    46 class QQuickWebView;
     47
     48namespace WebKit {
     49class QtWebContext;
     50}
    4751
    4852using namespace WebKit;
     
    202206#endif
    203207
    204     static PassRefPtr<WebContext> defaultWKContext();
    205     static RefPtr<WebContext> s_defaultContext;
    206     static RefPtr<QtDownloadManager> s_downloadManager;
    207     static unsigned s_defaultPageProxyCount;
    208 
    209     RefPtr<WebContext> m_context;
     208    RefPtr<QtWebContext> m_context;
    210209    QWKHistory* m_history;
    211210
Note: See TracChangeset for help on using the changeset viewer.