Changeset 101188 in webkit
- Timestamp:
- Nov 25, 2011, 11:17:59 PM (15 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 2 added
- 2 deleted
- 5 edited
-
ChangeLog (modified) (1 diff)
-
Target.pri (modified) (2 diffs)
-
UIProcess/qt/ClientImpl.cpp (deleted)
-
UIProcess/qt/ClientImpl.h (deleted)
-
UIProcess/qt/QtDownloadManager.cpp (modified) (1 diff)
-
UIProcess/qt/QtWebContext.cpp (added)
-
UIProcess/qt/QtWebContext.h (added)
-
UIProcess/qt/QtWebPageProxy.cpp (modified) (7 diffs)
-
UIProcess/qt/QtWebPageProxy.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r101179 r101188 1 2011-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 1 41 2011-11-25 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> 2 42 -
trunk/Source/WebKit2/Target.pri
r101164 r101188 314 314 UIProcess/WebResourceLoadClient.h \ 315 315 UIProcess/WebUIClient.h \ 316 UIProcess/qt/ ClientImpl.h \316 UIProcess/qt/QtWebContext.h \ 317 317 UIProcess/qt/QtWebPageEventHandler.h \ 318 318 UIProcess/qt/QtGestureRecognizer.h \ … … 618 618 UIProcess/WebResourceLoadClient.cpp \ 619 619 UIProcess/WebUIClient.cpp \ 620 UIProcess/qt/ ClientImpl.cpp \620 UIProcess/qt/QtWebContext.cpp \ 621 621 UIProcess/qt/LayerTreeHostProxyQt.cpp \ 622 622 UIProcess/qt/QtWebPageEventHandler.cpp \ -
trunk/Source/WebKit2/UIProcess/qt/QtDownloadManager.cpp
r101136 r101188 22 22 #include "QtDownloadManager.h" 23 23 24 #include "ClientImpl.h"25 24 #include "DownloadProxy.h" 26 25 #include "QtWebError.h" -
trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp
r101164 r101188 33 33 #include "qwebpreferences_p_p.h" 34 34 35 #include "ClientImpl.h"36 35 #include "DownloadProxy.h" 37 36 #include "DrawingAreaProxyImpl.h" … … 40 39 #include "FindIndicator.h" 41 40 #include "LocalizedStrings.h" 42 #include "MutableArray.h"43 41 #include "NotImplemented.h" 42 #include "QtDownloadManager.h" 44 43 #include "QtWebPageEventHandler.h" 45 44 #include "QtWebUndoCommand.h" … … 69 68 using namespace WebCore; 70 69 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 86 70 QtWebPageProxy::QtWebPageProxy(QQuickWebPage* qmlWebPage, QQuickWebView* qmlWebView, WKContextRef contextRef, WKPageGroupRef pageGroupRef) 87 71 : m_qmlWebPage(qmlWebPage) 88 72 , m_qmlWebView(qmlWebView) 89 , m_context(contextRef ? toImpl(contextRef) : defaultWKContext())73 , m_context(contextRef ? QtWebContext::create(toImpl(contextRef)) : QtWebContext::defaultContext()) 90 74 , m_undoStack(adoptPtr(new QUndoStack(this))) 91 75 , m_navigatorQtObjectEnabled(false) … … 93 77 m_webPageProxy = m_context->createWebPage(this, toImpl(pageGroupRef)); 94 78 m_history = QWKHistoryPrivate::createHistory(this, m_webPageProxy->backForwardList()); 95 if (!contextRef)96 s_defaultPageProxyCount++;97 79 } 98 80 … … 106 88 { 107 89 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 }117 90 delete m_history; 118 91 } … … 424 397 void QtWebPageProxy::setNavigatorQtObjectEnabled(bool enabled) 425 398 { 426 static String messageName("SetNavigatorQtObjectEnabled");427 428 399 ASSERT(enabled != m_navigatorQtObjectEnabled); 429 400 // FIXME: Currently we have to keep this information in both processes and the setting is asynchronous. 430 401 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); 436 403 } 437 404 438 405 void QtWebPageProxy::postMessageToNavigatorQtObject(const QString& message) 439 406 { 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); 447 408 } 448 409 … … 551 512 552 513 connect(downloadItem->d, SIGNAL(receivedResponse(QWebDownloadItem*)), this, SLOT(didReceiveDownloadResponse(QWebDownloadItem*))); 553 s_downloadManager->addDownload(download, downloadItem);514 m_context->downloadManager()->addDownload(download, downloadItem); 554 515 } 555 516 -
trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.h
r101164 r101188 25 25 #include "LayerTreeContext.h" 26 26 #include "PageClient.h" 27 #include "Qt DownloadManager.h"27 #include "QtWebContext.h" 28 28 #include "ShareableBitmap.h" 29 29 #include "ViewportArguments.h" 30 #include "WebContext.h"31 30 #include "WebPageProxy.h" 32 31 #include <wtf/RefPtr.h> … … 39 38 QT_END_NAMESPACE 40 39 40 class QQuickWebPage; 41 class QQuickWebView; 42 class QtWebError; 41 43 class QtWebPageEventHandler; 42 class Q tWebError;44 class QWebDownloadItem; 43 45 class QWebPreferences; 44 46 class QWKHistory; 45 class QQuickWebPage; 46 class QQuickWebView; 47 48 namespace WebKit { 49 class QtWebContext; 50 } 47 51 48 52 using namespace WebKit; … … 202 206 #endif 203 207 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; 210 209 QWKHistory* m_history; 211 210
Note:
See TracChangeset
for help on using the changeset viewer.