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; } }
void ChunkedUpdateDrawingAreaProxy::update(UpdateChunk* updateChunk) { drawUpdateChunkIntoBackingStore(updateChunk); WebPageProxy* page = this->page(); page->process()->connection()->send(DrawingAreaMessage::DidUpdate, page->pageID(), CoreIPC::In()); }
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; }
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; }
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. }
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()); }
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())); }
// 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()); }
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)); }
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)); }
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); }
void WebsiteDataStore::webPageWasRemoved(WebPageProxy& webPageProxy) { if (m_storageManager) m_storageManager->destroySessionStorageNamespace(webPageProxy.pageID()); }
void LayerBackedDrawingAreaProxy::update() { WebPageProxy* page = this->page(); page->process()->send(DrawingAreaLegacyMessage::DidUpdate, page->pageID(), CoreIPC::In(info().identifier)); }
void WebsiteDataStore::webPageWasAdded(WebPageProxy& webPageProxy) { if (m_storageManager) m_storageManager->createSessionStorageNamespace(webPageProxy.pageID(), std::numeric_limits<unsigned>::max()); }
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); }
void WebsiteDataStore::webPageDidCloseConnection(WebPageProxy& webPageProxy, IPC::Connection&) { if (m_storageManager) m_storageManager->setAllowedSessionStorageNamespaceConnection(webPageProxy.pageID(), nullptr); }
void WebsiteDataStore::webPageWillOpenConnection(WebPageProxy& webPageProxy, IPC::Connection& connection) { if (m_storageManager) m_storageManager->setAllowedSessionStorageNamespaceConnection(webPageProxy.pageID(), &connection); }
void TiledDrawingAreaProxy::takeSnapshot(const IntSize& size, const IntRect& contentsRect) { WebPageProxy* page = this->page(); page->process()->send(DrawingAreaLegacyMessage::TakeSnapshot, page->pageID(), CoreIPC::Out(size, contentsRect)); }