void WebFrameLoaderClient::dispatchDidCommitLoad() { WebPage* webPage = m_frame->page(); if (!webPage) return; const ResourceResponse& response = m_frame->coreFrame()->loader()->documentLoader()->response(); RefPtr<APIObject> userData; // Notify the bundle client. webPage->injectedBundleLoaderClient().didCommitLoadForFrame(webPage, m_frame, userData); webPage->sandboxExtensionTracker().didCommitProvisionalLoad(m_frame); // Notify the UIProcess. webPage->send(Messages::WebPageProxy::DidCommitLoadForFrame(m_frame->frameID(), response.mimeType(), m_frameHasCustomRepresentation, PlatformCertificateInfo(response), InjectedBundleUserMessageEncoder(userData.get()))); // Only restore the scale factor for standard frame loads (of the main frame). if (m_frame->isMainFrame() && m_frame->coreFrame()->loader()->loadType() == FrameLoadTypeStandard) { Page* page = m_frame->coreFrame()->page(); if (page && page->pageScaleFactor() != 1) webPage->scalePage(1, IntPoint()); } }
void WebFrameLoaderClient::dispatchDidBecomeFrameset(bool value) { WebPage* webPage = m_frame->page(); if (!webPage) return; webPage->send(Messages::WebPageProxy::FrameDidBecomeFrameSet(m_frame->frameID(), value)); }
void WebFrameLoaderClient::dispatchDidReceiveContentLength(DocumentLoader*, unsigned long identifier, int dataLength) { WebPage* webPage = m_frame->page(); if (!webPage) return; webPage->injectedBundleResourceLoadClient().didReceiveContentLengthForResource(webPage, m_frame, identifier, dataLength); webPage->send(Messages::WebPageProxy::DidReceiveContentLengthForResource(m_frame->frameID(), identifier, dataLength)); }
void WebFrameLoaderClient::dispatchDidFailLoading(DocumentLoader*, unsigned long identifier, const ResourceError& error) { WebPage* webPage = m_frame->page(); if (!webPage) return; webPage->injectedBundleResourceLoadClient().didFailLoadForResource(webPage, m_frame, identifier, error); webPage->send(Messages::WebPageProxy::DidFailLoadForResource(m_frame->frameID(), identifier, error)); }
void WebFrameLoaderClient::dispatchDidReceiveResponse(DocumentLoader*, unsigned long identifier, const ResourceResponse& response) { WebPage* webPage = m_frame->page(); if (!webPage) return; webPage->injectedBundleResourceLoadClient().didReceiveResponseForResource(webPage, m_frame, identifier, response); webPage->send(Messages::WebPageProxy::DidReceiveResponseForResource(m_frame->frameID(), identifier, response)); }
void WebFrameLoaderClient::didSaveToPageCache() { WebPage* webPage = m_frame->page(); if (!webPage) return; if (m_frame->isMainFrame()) return; webPage->send(Messages::WebPageProxy::DidSaveFrameToPageCache(m_frame->frameID())); }
void WebFrameLoaderClient::didDetectXSS(const KURL&, bool) { WebPage* webPage = m_frame->page(); if (!webPage) return; RefPtr<APIObject> userData; webPage->injectedBundleLoaderClient().didDetectXSSForFrame(webPage, m_frame, userData); webPage->send(Messages::WebPageProxy::DidDetectXSSForFrame(m_frame->frameID(), InjectedBundleUserMessageEncoder(userData.get()))); }
void WebFrameLoaderClient::didRestoreFromPageCache() { WebPage* webPage = m_frame->page(); if (!webPage) return; if (m_frame->isMainFrame()) return; WebFrame* parentFrame = static_cast<WebFrameLoaderClient*>(m_frame->coreFrame()->tree()->parent()->loader()->client())->webFrame(); webPage->send(Messages::WebPageProxy::DidRestoreFrameFromPageCache(m_frame->frameID(), parentFrame->frameID())); }
void WebFrameLoaderClient::didRunInsecureContent(SecurityOrigin*, const KURL&) { WebPage* webPage = m_frame->page(); if (!webPage) return; RefPtr<APIObject> userData; webPage->injectedBundleLoaderClient().didRunInsecureContentForFrame(webPage, m_frame, userData); webPage->send(Messages::WebPageProxy::DidRunInsecureContentForFrame(m_frame->frameID(), InjectedBundleUserMessageEncoder(userData.get()))); }
void WebFrameLoaderClient::assignIdentifierToInitialRequest(unsigned long identifier, DocumentLoader* loader, const ResourceRequest& request) { WebPage* webPage = m_frame->page(); if (!webPage) return; bool pageIsProvisionallyLoading = false; if (FrameLoader* frameLoader = loader->frameLoader()) pageIsProvisionallyLoading = frameLoader->provisionalDocumentLoader() == loader; webPage->injectedBundleResourceLoadClient().didInitiateLoadForResource(webPage, m_frame, identifier, request, pageIsProvisionallyLoading); webPage->send(Messages::WebPageProxy::DidInitiateLoadForResource(m_frame->frameID(), identifier, request, pageIsProvisionallyLoading)); }
void WebFrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout() { WebPage* webPage = m_frame->page(); if (!webPage) return; RefPtr<APIObject> userData; // Notify the bundle client. webPage->injectedBundleLoaderClient().didFirstVisuallyNonEmptyLayoutForFrame(webPage, m_frame, userData); // Notify the UIProcess. webPage->send(Messages::WebPageProxy::DidFirstVisuallyNonEmptyLayoutForFrame(m_frame->frameID(), InjectedBundleUserMessageEncoder(userData.get()))); }
void WebFrameLoaderClient::dispatchUnableToImplementPolicy(const ResourceError& error) { WebPage* webPage = m_frame->page(); if (!webPage) return; RefPtr<APIObject> userData; // Notify the bundle client. webPage->injectedBundlePolicyClient().unableToImplementPolicy(webPage, m_frame, error, userData); // Notify the UIProcess. webPage->send(Messages::WebPageProxy::UnableToImplementPolicy(m_frame->frameID(), error, InjectedBundleUserMessageEncoder(userData.get()))); }
void WebFrameLoaderClient::dispatchDidPopStateWithinPage() { WebPage* webPage = m_frame->page(); if (!webPage) return; RefPtr<APIObject> userData; // Notify the bundle client. webPage->injectedBundleLoaderClient().didSameDocumentNavigationForFrame(webPage, m_frame, SameDocumentNavigationSessionStatePop, userData); // Notify the UIProcess. webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), SameDocumentNavigationSessionStatePop, m_frame->coreFrame()->document()->url().string(), InjectedBundleUserMessageEncoder(userData.get()))); }
void WebFrameLoaderClient::detachedFromParent2() { WebPage* webPage = m_frame->page(); if (!webPage) return; RefPtr<APIObject> userData; // Notify the bundle client. webPage->injectedBundleLoaderClient().didRemoveFrameFromHierarchy(webPage, m_frame, userData); // Notify the UIProcess. webPage->send(Messages::WebPageProxy::DidRemoveFrameFromHierarchy(m_frame->frameID(), InjectedBundleUserMessageEncoder(userData.get()))); }
void WebFrameLoaderClient::dispatchDidReceiveTitle(const StringWithDirection& title) { WebPage* webPage = m_frame->page(); if (!webPage) return; RefPtr<APIObject> userData; // Notify the bundle client. // FIXME: use direction of title. webPage->injectedBundleLoaderClient().didReceiveTitleForFrame(webPage, title.string(), m_frame, userData); // Notify the UIProcess. webPage->send(Messages::WebPageProxy::DidReceiveTitleForFrame(m_frame->frameID(), title.string(), InjectedBundleUserMessageEncoder(userData.get()))); }
void WebFrameLoaderClient::dispatchWillSendRequest(DocumentLoader*, unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse) { WebPage* webPage = m_frame->page(); if (!webPage) return; webPage->injectedBundleResourceLoadClient().willSendRequestForFrame(webPage, m_frame, identifier, request, redirectResponse); if (request.isNull()) { // FIXME: We should probably send a message saying we cancelled the request for the resource. return; } webPage->send(Messages::WebPageProxy::DidSendRequestForResource(m_frame->frameID(), identifier, request, redirectResponse)); }
void WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad() { WebPage* webPage = m_frame->page(); if (!webPage) return; DocumentLoader* provisionalLoader = m_frame->coreFrame()->loader()->provisionalDocumentLoader(); const String& url = provisionalLoader->url().string(); RefPtr<APIObject> userData; // Notify the bundle client. webPage->injectedBundleLoaderClient().didReceiveServerRedirectForProvisionalLoadForFrame(webPage, m_frame, userData); // Notify the UIProcess. webPage->send(Messages::WebPageProxy::DidReceiveServerRedirectForProvisionalLoadForFrame(m_frame->frameID(), url, InjectedBundleUserMessageEncoder(userData.get()))); }
void WebFrameLoaderClient::dispatchDidFirstLayout() { WebPage* webPage = m_frame->page(); if (!webPage) return; RefPtr<APIObject> userData; // Notify the bundle client. webPage->injectedBundleLoaderClient().didFirstLayoutForFrame(webPage, m_frame, userData); // Notify the UIProcess. webPage->send(Messages::WebPageProxy::DidFirstLayoutForFrame(m_frame->frameID(), InjectedBundleUserMessageEncoder(userData.get()))); if (m_frame == m_frame->page()->mainWebFrame()) webPage->drawingArea()->setLayerTreeStateIsFrozen(false); }
void WebFrameLoaderClient::dispatchDidLayout() { WebPage* webPage = m_frame->page(); if (!webPage) return; // Notify the bundle client. webPage->injectedBundleLoaderClient().didLayoutForFrame(webPage, m_frame); // NOTE: Unlike the other layout notifications, this does not notify the // the UIProcess for every call. if (m_frame == m_frame->page()->mainWebFrame()) { // FIXME: Remove at the soonest possible time. webPage->send(Messages::WebPageProxy::SetRenderTreeSize(webPage->renderTreeSize())); webPage->mainFrameDidLayout(); } }
void WebFrameLoaderClient::dispatchDidFailLoad(const ResourceError& error) { WebPage* webPage = m_frame->page(); if (!webPage) return; RefPtr<APIObject> userData; // Notify the bundle client. webPage->injectedBundleLoaderClient().didFailLoadWithErrorForFrame(webPage, m_frame, error, userData); // Notify the UIProcess. webPage->send(Messages::WebPageProxy::DidFailLoadForFrame(m_frame->frameID(), error, InjectedBundleUserMessageEncoder(userData.get()))); // If we have a load listener, notify it. if (WebFrame::LoadListener* loadListener = m_frame->loadListener()) loadListener->didFailLoad(m_frame, error.isCancellation()); }
void WebFrameLoaderClient::dispatchDidFinishLoad() { WebPage* webPage = m_frame->page(); if (!webPage) return; RefPtr<APIObject> userData; // Notify the bundle client. webPage->injectedBundleLoaderClient().didFinishLoadForFrame(webPage, m_frame, userData); // Notify the UIProcess. webPage->send(Messages::WebPageProxy::DidFinishLoadForFrame(m_frame->frameID(), InjectedBundleUserMessageEncoder(userData.get()))); // If we have a load listener, notify it. if (WebFrame::LoadListener* loadListener = m_frame->loadListener()) loadListener->didFinishLoad(m_frame); }
void WebFrameLoaderClient::dispatchDidStartProvisionalLoad() { WebPage* webPage = m_frame->page(); if (!webPage) return; webPage->findController().hideFindUI(); webPage->sandboxExtensionTracker().didStartProvisionalLoad(m_frame); DocumentLoader* provisionalLoader = m_frame->coreFrame()->loader()->provisionalDocumentLoader(); const String& url = provisionalLoader->url().string(); RefPtr<APIObject> userData; // Notify the bundle client. webPage->injectedBundleLoaderClient().didStartProvisionalLoadForFrame(webPage, m_frame, userData); String unreachableURL = provisionalLoader->unreachableURL().string(); // Notify the UIProcess. webPage->send(Messages::WebPageProxy::DidStartProvisionalLoadForFrame(m_frame->frameID(), url, unreachableURL, InjectedBundleUserMessageEncoder(userData.get()))); }
void WebFrameLoaderClient::dispatchWillSubmitForm(FramePolicyFunction function, PassRefPtr<FormState> prpFormState) { WebPage* webPage = m_frame->page(); if (!webPage) return; // FIXME: Pass more of the form state. RefPtr<FormState> formState = prpFormState; HTMLFormElement* form = formState->form(); WebFrame* sourceFrame = static_cast<WebFrameLoaderClient*>(formState->sourceFrame()->loader()->client())->webFrame(); const Vector<std::pair<String, String> >& values = formState->textFieldValues(); RefPtr<APIObject> userData; webPage->injectedBundleFormClient().willSubmitForm(webPage, form, m_frame, sourceFrame, values, userData); uint64_t listenerID = m_frame->setUpPolicyListener(function); StringPairVector valuesVector(values); webPage->send(Messages::WebPageProxy::WillSubmitForm(m_frame->frameID(), sourceFrame->frameID(), valuesVector, listenerID, InjectedBundleUserMessageEncoder(userData.get()))); }
void WebFrameLoaderClient::finishedLoading(DocumentLoader* loader) { if (!m_pluginView) { committedLoad(loader, 0, 0); if (m_frameHasCustomRepresentation) { WebPage* webPage = m_frame->page(); if (!webPage) return; RefPtr<SharedBuffer> mainResourceData = loader->mainResourceData(); CoreIPC::DataReference dataReference(reinterpret_cast<const uint8_t*>(mainResourceData ? mainResourceData->data() : 0), mainResourceData ? mainResourceData->size() : 0); webPage->send(Messages::WebPageProxy::DidFinishLoadingDataForCustomRepresentation(loader->response().suggestedFilename(), dataReference)); } return; } m_pluginView->manualLoadDidFinishLoading(); m_pluginView = 0; m_hasSentResponseToPluginView = false; }
void WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const NavigationAction& navigationAction, const ResourceRequest& request, PassRefPtr<FormState> formState, const String& frameName) { WebPage* webPage = m_frame->page(); if (!webPage) return; RefPtr<APIObject> userData; RefPtr<InjectedBundleNavigationAction> action = InjectedBundleNavigationAction::create(m_frame, navigationAction, formState); // Notify the bundle client. WKBundlePagePolicyAction policy = webPage->injectedBundlePolicyClient().decidePolicyForNewWindowAction(webPage, m_frame, action.get(), request, frameName, userData); if (policy == WKBundlePagePolicyActionUse) { (m_frame->coreFrame()->loader()->policyChecker()->*function)(PolicyUse); return; } uint64_t listenerID = m_frame->setUpPolicyListener(function); // Notify the UIProcess. webPage->send(Messages::WebPageProxy::DecidePolicyForNewWindowAction(m_frame->frameID(), action->navigationType(), action->modifiers(), action->mouseButton(), request, frameName, listenerID, InjectedBundleUserMessageEncoder(userData.get()))); }