Beispiel #1
0
void WebPageProxy::didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder& arguments, CoreIPC::ArgumentEncoder& reply)
{
    switch (messageID.get<WebPageProxyMessage::Kind>()) {
        case WebPageProxyMessage::CreateNewPage: {
            WebPageProxy* newPage = createNewPage();
            if (newPage) {
                // FIXME: Pass the real size.
                reply.encode(CoreIPC::In(newPage->pageID(), IntSize(100, 100), 
                                         newPage->pageNamespace()->context()->preferences()->store(),
                                         *(newPage->m_drawingArea.get())));
            } else {
                // FIXME: We should encode a drawing area type here instead.
                reply.encode(CoreIPC::In(static_cast<uint64_t>(0), IntSize(), WebPreferencesStore(), 0));
            }
            break;
        }
        case WebPageProxyMessage::RunJavaScriptAlert: {
            uint64_t frameID;
            String alertText;
            if (!arguments.decode(CoreIPC::Out(frameID, alertText)))
                return;
            runJavaScriptAlert(webFrame(frameID), alertText);
            break;
        }
        default:
            ASSERT_NOT_REACHED();
            break;
    }
}
Beispiel #2
0
void ChunkedUpdateDrawingAreaProxy::update(UpdateChunk* updateChunk)
{
    drawUpdateChunkIntoBackingStore(updateChunk);

    WebPageProxy* page = this->page();
    page->process()->connection()->send(DrawingAreaMessage::DidUpdate, page->pageID(), CoreIPC::In());
}
Beispiel #3
0
void TiledDrawingAreaProxy::removeTile(const TiledDrawingAreaTile::Coordinate& coordinate)
{
    RefPtr<TiledDrawingAreaTile> tile = m_tiles.take(coordinate);

    m_tilesByID.remove(tile->ID());

    if (!tile->hasBackBufferUpdatePending())
        return;
    WebPageProxy* page = this->page();
    page->process()->send(DrawingAreaLegacyMessage::CancelTileUpdate, page->pageID(), CoreIPC::In(tile->ID()));
}
ViewGestureController::ViewGestureController(WebPageProxy& webPageProxy)
    : m_webPageProxy(webPageProxy)
    , m_swipeActiveLoadMonitoringTimer(RunLoop::main(), this, &ViewGestureController::checkForActiveLoads)
#if PLATFORM(MAC)
    , m_pendingSwipeTracker(webPageProxy, std::bind(&ViewGestureController::trackSwipeGesture, this, std::placeholders::_1, std::placeholders::_2))
#endif
{
    m_webPageProxy.process().addMessageReceiver(Messages::ViewGestureController::messageReceiverName(), m_webPageProxy.pageID(), *this);

    viewGestureControllersForAllPages().add(webPageProxy.pageID(), this);
}
// Called by WebInspectorProxy messages
void WebInspectorProxy::createInspectorPage(uint64_t& inspectorPageID, WebPageCreationParameters& inspectorPageParameters)
{
    inspectorPageID = 0;

    if (!m_page)
        return;

    m_isAttached = shouldOpenAttached();
    m_attachmentSide = static_cast<AttachmentSide>(inspectorPageGroup()->preferences()->inspectorAttachmentSide());

    WebPageProxy* inspectorPage = platformCreateInspectorPage();
    ASSERT(inspectorPage);
    if (!inspectorPage)
        return;

    inspectorPageID = inspectorPage->pageID();
    inspectorPageParameters = inspectorPage->creationParameters();

    WKPagePolicyClientV1 policyClient = {
        { 1, this },
        0, /* decidePolicyForNavigationAction_deprecatedForUseWithV0 */
        0, /* decidePolicyForNewWindowAction */
        0, /* decidePolicyForResponse_deprecatedForUseWithV0 */
        0, /* unableToImplementPolicy */
        decidePolicyForNavigationAction,
        0, /* decidePolicyForResponse */
    };

    WKPageSetPagePolicyClient(toAPI(inspectorPage), &policyClient.base);

    String url = inspectorPageURL();

    url.append("?dockSide=");

    if (m_isAttached) {
        switch (m_attachmentSide) {
        case AttachmentSideBottom:
            url.append("bottom");
            m_page->process().send(Messages::WebInspector::AttachedBottom(), m_page->pageID());
            break;
        case AttachmentSideRight:
            url.append("right");
            m_page->process().send(Messages::WebInspector::AttachedRight(), m_page->pageID());
            break;
        }
    } else
        url.append("undocked");

    m_page->process().assumeReadAccessToBaseURL(inspectorBaseURL());

    inspectorPage->loadRequest(URL(URL(), url));

    m_createdInspectorPage = true;
}
Beispiel #6
0
void ChunkedUpdateDrawingAreaProxy::setPageIsVisible(bool isVisible)
{
    WebPageProxy* page = this->page();

    if (isVisible == m_isVisible)
        return;
    
    m_isVisible = isVisible;
    if (!page->isValid())
        return;

    if (!m_isVisible) {
        // Tell the web process that it doesn't need to paint anything for now.
        page->process()->send(DrawingAreaMessage::SuspendPainting, page->pageID(), CoreIPC::In(id()));
        return;
    }
    
    // The page is now visible, resume painting.
    page->process()->send(DrawingAreaMessage::ResumePainting, page->pageID(), CoreIPC::In(id(), m_forceRepaintWhenResumingPainting));
    m_forceRepaintWhenResumingPainting = false;
}
Beispiel #7
0
void LayerBackedDrawingAreaProxy::setPageIsVisible(bool isVisible)
{
    WebPageProxy* page = this->page();

    if (isVisible == m_isVisible)
        return;
    
    m_isVisible = isVisible;
    if (!page->isValid())
        return;

    if (!m_isVisible) {
        // Tell the web process that it doesn't need to paint anything for now.
        page->process()->send(DrawingAreaLegacyMessage::SuspendPainting, page->pageID(), CoreIPC::In(info().identifier));
        return;
    }
    
    // The page is now visible.
    page->process()->send(DrawingAreaLegacyMessage::ResumePainting, page->pageID(), CoreIPC::In(info().identifier));
    
    // FIXME: We should request a full repaint here if needed.
}
Beispiel #8
0
void WebsiteDataStore::cloneSessionData(WebPageProxy& sourcePage, WebPageProxy& newPage)
{
    auto& sourceDataStore = sourcePage.websiteDataStore();
    auto& newDataStore = newPage.websiteDataStore();

    // FIXME: Handle this.
    if (&sourceDataStore != &newDataStore)
        return;

    if (!sourceDataStore.m_storageManager)
        return;

    sourceDataStore.m_storageManager->cloneSessionStorageNamespace(sourcePage.pageID(), newPage.pageID());
}
Beispiel #9
0
void ChunkedUpdateDrawingAreaProxy::update(UpdateChunk* updateChunk)
{
    if (!m_isVisible) {
        // We got an update request that must have been sent before we told the web process to suspend painting.
        // Don't paint this into the backing store, because that could leave the backing store in an inconsistent state.
        // Instead, we will just tell the drawing area to repaint everything when we resume painting.
        m_forceRepaintWhenResumingPainting = true;
    } else {
        // Just paint into backing store.
        drawUpdateChunkIntoBackingStore(updateChunk);
    }

    WebPageProxy* page = this->page();
    page->process()->send(DrawingAreaMessage::DidUpdate, page->pageID(), CoreIPC::In(id()));
}
Beispiel #10
0
// Called by WebInspectorProxy messages
void WebInspectorProxy::createInspectorPage(uint64_t& inspectorPageID, WebPageCreationParameters& inspectorPageParameters)
{
    inspectorPageID = 0;

    if (!m_page)
        return;

    WebPageProxy* inspectorPage = platformCreateInspectorPage();
    ASSERT(inspectorPage);
    if (!inspectorPage)
        return;

    inspectorPageID = inspectorPage->pageID();
    inspectorPageParameters = inspectorPage->creationParameters(IntSize(0, 0));

    inspectorPage->loadURL(inspectorPageURL());
}
Beispiel #11
0
void ChunkedUpdateDrawingAreaProxy::setSize(const IntSize& viewSize)
{
    WebPageProxy* page = this->page();
    if (!page->isValid())
        return;

    if (viewSize.isEmpty())
        return;

    m_viewSize = viewSize;
    m_lastSetViewSize = viewSize;

    if (m_isWaitingForDidSetFrameNotification)
        return;
    m_isWaitingForDidSetFrameNotification = true;

    page->process()->responsivenessTimer()->start();
    page->process()->send(DrawingAreaMessage::SetSize, page->pageID(), CoreIPC::In(id(), viewSize));
}
Beispiel #12
0
void TiledDrawingAreaProxy::sizeDidChange()
{
    WebPageProxy* page = this->page();
    if (!page || !page->isValid())
        return;

    if (m_size.isEmpty())
        return;

    m_viewSize = m_size;
    m_lastSetViewSize = m_size;

    if (m_isWaitingForDidSetFrameNotification)
        return;
    m_isWaitingForDidSetFrameNotification = true;

    page->process()->responsivenessTimer()->start();
    page->process()->send(DrawingAreaLegacyMessage::SetSize, page->pageID(), CoreIPC::In(m_size));
}
Beispiel #13
0
void LayerBackedDrawingAreaProxy::sizeDidChange()
{
    WebPageProxy* page = this->page();
    if (!page->isValid())
        return;

    if (m_size.isEmpty())
        return;

    m_lastSetViewSize = m_size;

    platformSetSize();

    if (m_isWaitingForDidSetFrameNotification)
        return;

    m_isWaitingForDidSetFrameNotification = true;

    page->process()->send(DrawingAreaLegacyMessage::SetSize, page->pageID(), CoreIPC::In(info().identifier, m_size));
}
// Called by WebInspectorProxy messages
void WebInspectorProxy::createInspectorPage(uint64_t& inspectorPageID, WebPageCreationParameters& inspectorPageParameters)
{
    inspectorPageID = 0;

    if (!m_page)
        return;

    m_isAttached = shouldOpenAttached();

    WebPageProxy* inspectorPage = platformCreateInspectorPage();
    ASSERT(inspectorPage);
    if (!inspectorPage)
        return;

    inspectorPageID = inspectorPage->pageID();
    inspectorPageParameters = inspectorPage->creationParameters();

    String url = inspectorPageURL();
    if (m_isAttached)
        url += "?docked=true";
    m_page->process()->assumeReadAccessToBaseURL(inspectorBaseURL());
    inspectorPage->loadURL(url);
}
Beispiel #15
0
void WebsiteDataStore::webPageWasRemoved(WebPageProxy& webPageProxy)
{
    if (m_storageManager)
        m_storageManager->destroySessionStorageNamespace(webPageProxy.pageID());
}
Beispiel #16
0
void LayerBackedDrawingAreaProxy::update()
{
    WebPageProxy* page = this->page();
    page->process()->send(DrawingAreaLegacyMessage::DidUpdate, page->pageID(), CoreIPC::In(info().identifier));
}
Beispiel #17
0
void WebsiteDataStore::webPageWasAdded(WebPageProxy& webPageProxy)
{
    if (m_storageManager)
        m_storageManager->createSessionStorageNamespace(webPageProxy.pageID(), std::numeric_limits<unsigned>::max());
}
Beispiel #18
0
void ChunkedUpdateDrawingAreaProxy::paint(const IntRect& rect, PlatformDrawingContext context)
{
    if (m_isWaitingForDidSetFrameNotification) {
        WebPageProxy* page = this->page();
        if (!page->isValid())
            return;
        
        if (page->process()->isLaunching())
            return;

        OwnPtr<CoreIPC::ArgumentDecoder> arguments = page->process()->connection()->waitFor(DrawingAreaProxyMessage::DidSetSize, page->pageID(), 0.04);
        if (arguments)
            didReceiveMessage(page->process()->connection(), CoreIPC::MessageID(DrawingAreaProxyMessage::DidSetSize), arguments.get());
    }

    platformPaint(rect, context);
}
Beispiel #19
0
void WebsiteDataStore::webPageDidCloseConnection(WebPageProxy& webPageProxy, IPC::Connection&)
{
    if (m_storageManager)
        m_storageManager->setAllowedSessionStorageNamespaceConnection(webPageProxy.pageID(), nullptr);
}
Beispiel #20
0
void WebsiteDataStore::webPageWillOpenConnection(WebPageProxy& webPageProxy, IPC::Connection& connection)
{
    if (m_storageManager)
        m_storageManager->setAllowedSessionStorageNamespaceConnection(webPageProxy.pageID(), &connection);
}
Beispiel #21
0
void TiledDrawingAreaProxy::takeSnapshot(const IntSize& size, const IntRect& contentsRect)
{
    WebPageProxy* page = this->page();
    page->process()->send(DrawingAreaLegacyMessage::TakeSnapshot, page->pageID(), CoreIPC::Out(size, contentsRect));
}