summaryrefslogtreecommitdiffstats
path: root/WebKit/chromium/src/FrameLoaderClientImpl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/chromium/src/FrameLoaderClientImpl.cpp')
-rw-r--r--WebKit/chromium/src/FrameLoaderClientImpl.cpp387
1 files changed, 226 insertions, 161 deletions
diff --git a/WebKit/chromium/src/FrameLoaderClientImpl.cpp b/WebKit/chromium/src/FrameLoaderClientImpl.cpp
index b984308..9d79599 100644
--- a/WebKit/chromium/src/FrameLoaderClientImpl.cpp
+++ b/WebKit/chromium/src/FrameLoaderClientImpl.cpp
@@ -32,12 +32,15 @@
#include "FrameLoaderClientImpl.h"
#include "Chrome.h"
-#include "CString.h"
#include "Document.h"
#include "DocumentLoader.h"
#include "FormState.h"
#include "FrameLoader.h"
#include "FrameLoadRequest.h"
+#include "FrameNetworkingContextImpl.h"
+#include "FrameView.h"
+#include "HTTPParsers.h"
+#include "HistoryItem.h"
#include "HitTestResult.h"
#include "HTMLAppletElement.h"
#include "HTMLFormElement.h" // needed by FormState.h
@@ -48,6 +51,8 @@
#include "PlatformString.h"
#include "PluginData.h"
#include "PluginDataChromium.h"
+#include "ProgressTracker.h"
+#include "Settings.h"
#include "StringExtras.h"
#include "WebDataSourceImpl.h"
#include "WebDevToolsAgentPrivate.h"
@@ -71,6 +76,7 @@
#include "WindowFeatures.h"
#include "WrappedResourceRequest.h"
#include "WrappedResourceResponse.h"
+#include <wtf/text/CString.h>
using namespace WebCore;
@@ -142,6 +148,14 @@ void FrameLoaderClientImpl::didCreateIsolatedScriptContext()
m_webFrame->client()->didCreateIsolatedScriptContext(m_webFrame);
}
+bool FrameLoaderClientImpl::allowScriptExtension(const String& extensionName,
+ int extensionGroup)
+{
+ if (m_webFrame->client())
+ return m_webFrame->client()->allowScriptExtension(m_webFrame, extensionName, extensionGroup);
+ return false;
+}
+
void FrameLoaderClientImpl::didPerformFirstNavigation() const
{
}
@@ -180,6 +194,18 @@ bool FrameLoaderClientImpl::allowImages(bool enabledPerSettings)
return enabledPerSettings;
}
+void FrameLoaderClientImpl::didNotAllowScript()
+{
+ if (m_webFrame->client())
+ m_webFrame->client()->didNotAllowScript(m_webFrame);
+}
+
+void FrameLoaderClientImpl::didNotAllowPlugins()
+{
+ if (m_webFrame->client())
+ m_webFrame->client()->didNotAllowPlugins(m_webFrame);
+}
+
bool FrameLoaderClientImpl::hasWebView() const
{
return m_webFrame->viewImpl();
@@ -232,10 +258,15 @@ void FrameLoaderClientImpl::detachedFromParent3()
// go to a page and then navigate to a new page without getting any asserts
// or crashes.
m_webFrame->frame()->script()->proxy()->clearForClose();
-
+
+ // Alert the client that the frame is being detached. This is the last
+ // chance we have to communicate with the client.
+ if (m_webFrame->client())
+ m_webFrame->client()->frameDetached(m_webFrame);
+
// Stop communicating with the WebFrameClient at this point since we are no
// longer associated with the Page.
- m_webFrame->dropClient();
+ m_webFrame->setClient(0);
}
// This function is responsible for associating the |identifier| with a given
@@ -258,7 +289,7 @@ void FrameLoaderClientImpl::assignIdentifierToInitialRequest(
// this includes images and xmlhttp requests. It is important to note that a
// subresource is NOT limited to stuff loaded through the frame's subresource
// loader. Synchronous xmlhttp requests for example, do not go through the
-// subresource loader, but we still label them as TargetIsSubResource.
+// subresource loader, but we still label them as TargetIsSubresource.
//
// The important edge cases to consider when modifying this function are
// how synchronous resource loads are treated during load/unload threshold.
@@ -392,12 +423,6 @@ bool FrameLoaderClientImpl::dispatchDidLoadResourceFromMemoryCache(
return false; // Do not suppress remaining notifications
}
-void FrameLoaderClientImpl::dispatchDidLoadResourceByXMLHttpRequest(
- unsigned long identifier,
- const ScriptString& source)
-{
-}
-
void FrameLoaderClientImpl::dispatchDidHandleOnloadEvents()
{
if (m_webFrame->client())
@@ -556,7 +581,7 @@ void FrameLoaderClientImpl::dispatchWillPerformClientRedirect(
}
}
-void FrameLoaderClientImpl::dispatchDidChangeLocationWithinPage()
+void FrameLoaderClientImpl::dispatchDidNavigateWithinPage()
{
// Anchor fragment navigations are not normal loads, so we need to synthesize
// some events for our delegate.
@@ -567,12 +592,17 @@ void FrameLoaderClientImpl::dispatchDidChangeLocationWithinPage()
// them for fragment redirection that happens in window.onload handler.
// See https://bugs.webkit.org/show_bug.cgi?id=31838
bool loaderCompleted =
- !m_webFrame->frame()->page()->mainFrame()->loader()->isLoading();
+ !webView->page()->mainFrame()->loader()->activeDocumentLoader()->isLoadingInAPISense();
// Generate didStartLoading if loader is completed.
if (webView->client() && loaderCompleted)
webView->client()->didStartLoading();
+ // We need to classify some hash changes as client redirects.
+ // FIXME: It seems wrong that the currentItem can sometimes be null.
+ HistoryItem* currentItem = m_webFrame->frame()->loader()->history()->currentItem();
+ bool isHashChange = !currentItem || !currentItem->stateObject();
+
WebDataSourceImpl* ds = m_webFrame->dataSourceImpl();
ASSERT(ds); // Should not be null when navigating to a reference fragment!
if (ds) {
@@ -583,27 +613,29 @@ void FrameLoaderClientImpl::dispatchDidChangeLocationWithinPage()
ds->clearRedirectChain();
}
- // Figure out if this location change is because of a JS-initiated
- // client redirect (e.g onload/setTimeout document.location.href=).
- // FIXME: (bugs 1085325, 1046841) We don't get proper redirect
- // performed/cancelled notifications across anchor navigations, so the
- // other redirect-tracking code in this class (see
- // dispatch*ClientRedirect() and dispatchDidStartProvisionalLoad) is
- // insufficient to catch and properly flag these transitions. Once a
- // proper fix for this bug is identified and applied the following
- // block may no longer be required.
- bool wasClientRedirect =
- (url == m_expectedClientRedirectDest && chainEnd == m_expectedClientRedirectSrc)
- || !m_webFrame->isProcessingUserGesture();
-
- if (wasClientRedirect) {
- if (m_webFrame->client())
- m_webFrame->client()->didCompleteClientRedirect(m_webFrame, chainEnd);
- ds->appendRedirect(chainEnd);
- // Make sure we clear the expected redirect since we just effectively
- // completed it.
- m_expectedClientRedirectSrc = KURL();
- m_expectedClientRedirectDest = KURL();
+ if (isHashChange) {
+ // Figure out if this location change is because of a JS-initiated
+ // client redirect (e.g onload/setTimeout document.location.href=).
+ // FIXME: (b/1085325, b/1046841) We don't get proper redirect
+ // performed/cancelled notifications across anchor navigations, so the
+ // other redirect-tracking code in this class (see
+ // dispatch*ClientRedirect() and dispatchDidStartProvisionalLoad) is
+ // insufficient to catch and properly flag these transitions. Once a
+ // proper fix for this bug is identified and applied the following
+ // block may no longer be required.
+ bool wasClientRedirect =
+ (url == m_expectedClientRedirectDest && chainEnd == m_expectedClientRedirectSrc)
+ || !m_webFrame->isProcessingUserGesture();
+
+ if (wasClientRedirect) {
+ if (m_webFrame->client())
+ m_webFrame->client()->didCompleteClientRedirect(m_webFrame, chainEnd);
+ ds->appendRedirect(chainEnd);
+ // Make sure we clear the expected redirect since we just effectively
+ // completed it.
+ m_expectedClientRedirectSrc = KURL();
+ m_expectedClientRedirectDest = KURL();
+ }
}
// Regardless of how we got here, we are navigating to a URL so we need to
@@ -614,26 +646,32 @@ void FrameLoaderClientImpl::dispatchDidChangeLocationWithinPage()
bool isNewNavigation;
webView->didCommitLoad(&isNewNavigation);
if (m_webFrame->client())
- m_webFrame->client()->didChangeLocationWithinPage(m_webFrame, isNewNavigation);
+ m_webFrame->client()->didNavigateWithinPage(m_webFrame, isNewNavigation);
// Generate didStopLoading if loader is completed.
if (webView->client() && loaderCompleted)
webView->client()->didStopLoading();
}
+void FrameLoaderClientImpl::dispatchDidChangeLocationWithinPage()
+{
+ if (m_webFrame)
+ m_webFrame->client()->didChangeLocationWithinPage(m_webFrame);
+}
+
void FrameLoaderClientImpl::dispatchDidPushStateWithinPage()
{
- // FIXME
+ dispatchDidNavigateWithinPage();
}
void FrameLoaderClientImpl::dispatchDidReplaceStateWithinPage()
{
- // FIXME
+ dispatchDidNavigateWithinPage();
}
void FrameLoaderClientImpl::dispatchDidPopStateWithinPage()
{
- // FIXME
+ // Ignored since dispatchDidNavigateWithinPage was already called.
}
void FrameLoaderClientImpl::dispatchWillClose()
@@ -700,6 +738,12 @@ void FrameLoaderClientImpl::dispatchDidReceiveTitle(const String& title)
m_webFrame->client()->didReceiveTitle(m_webFrame, title);
}
+void FrameLoaderClientImpl::dispatchDidChangeIcons()
+{
+ if (m_webFrame->client())
+ m_webFrame->client()->didChangeIcons(m_webFrame);
+}
+
void FrameLoaderClientImpl::dispatchDidCommitLoad()
{
WebViewImpl* webview = m_webFrame->viewImpl();
@@ -708,9 +752,6 @@ void FrameLoaderClientImpl::dispatchDidCommitLoad()
if (m_webFrame->client())
m_webFrame->client()->didCommitProvisionalLoad(m_webFrame, isNewNavigation);
-
- if (webview->devToolsAgentPrivate())
- webview->devToolsAgentPrivate()->didCommitProvisionalLoad(m_webFrame, isNewNavigation);
}
void FrameLoaderClientImpl::dispatchDidFailProvisionalLoad(
@@ -762,19 +803,21 @@ void FrameLoaderClientImpl::dispatchDidFinishLoad()
void FrameLoaderClientImpl::dispatchDidFirstLayout()
{
+ if (m_webFrame->client())
+ m_webFrame->client()->didFirstLayout(m_webFrame);
}
void FrameLoaderClientImpl::dispatchDidFirstVisuallyNonEmptyLayout()
{
- // FIXME: called when webkit finished layout of a page that was visually non-empty.
- // All resources have not necessarily finished loading.
+ if (m_webFrame->client())
+ m_webFrame->client()->didFirstVisuallyNonEmptyLayout(m_webFrame);
}
-Frame* FrameLoaderClientImpl::dispatchCreatePage()
+Frame* FrameLoaderClientImpl::dispatchCreatePage(const NavigationAction& action)
{
struct WindowFeatures features;
Page* newPage = m_webFrame->frame()->page()->chrome()->createWindow(
- m_webFrame->frame(), FrameLoadRequest(), features);
+ m_webFrame->frame(), FrameLoadRequest(), features, action);
// Make sure that we have a valid disposition. This should have been set in
// the preceeding call to dispatchDecidePolicyForNewWindowAction.
@@ -797,38 +840,6 @@ void FrameLoaderClientImpl::dispatchShow()
webView->client()->show(webView->initialNavigationPolicy());
}
-static bool shouldTreatAsAttachment(const ResourceResponse& response)
-{
- const String& contentDisposition =
- response.httpHeaderField("Content-Disposition");
- if (contentDisposition.isEmpty())
- return false;
-
- // Some broken sites just send
- // Content-Disposition: ; filename="file"
- // screen those out here.
- if (contentDisposition.startsWith(";"))
- return false;
-
- if (contentDisposition.startsWith("inline", false))
- return false;
-
- // Some broken sites just send
- // Content-Disposition: filename="file"
- // without a disposition token... screen those out.
- if (contentDisposition.startsWith("filename", false))
- return false;
-
- // Also in use is Content-Disposition: name="file"
- if (contentDisposition.startsWith("name", false))
- return false;
-
- // We have a content-disposition of "attachment" or unknown.
- // RFC 2183, section 2.8 says that an unknown disposition
- // value should be treated as "attachment"
- return true;
-}
-
void FrameLoaderClientImpl::dispatchDecidePolicyForMIMEType(
FramePolicyFunction function,
const String& mimeType,
@@ -843,7 +854,7 @@ void FrameLoaderClientImpl::dispatchDecidePolicyForMIMEType(
if (statusCode == 204 || statusCode == 205) {
// The server does not want us to replace the page contents.
action = PolicyIgnore;
- } else if (shouldTreatAsAttachment(response)) {
+ } else if (WebCore::contentDispositionType(response.httpHeaderField("Content-Disposition")) == WebCore::ContentDispositionAttachment) {
// The server wants us to download instead of replacing the page contents.
// Downloading is handled by the embedder, but we still get the initial
// response so that we can ignore it and clean up properly.
@@ -898,51 +909,48 @@ void FrameLoaderClientImpl::dispatchDecidePolicyForNavigationAction(
// The null check here is to fix a crash that seems strange
// (see - https://bugs.webkit.org/show_bug.cgi?id=23554).
if (m_webFrame->client() && !request.url().isNull()) {
- WebNavigationPolicy navigationPolicy = WebNavigationPolicyCurrentTab;
- actionSpecifiesNavigationPolicy(action, &navigationPolicy);
-
- // Give the delegate a chance to change the navigation policy.
- const WebDataSourceImpl* ds = m_webFrame->provisionalDataSourceImpl();
- if (ds) {
- KURL url = ds->request().url();
- if (url.protocolIs(backForwardNavigationScheme)) {
- handleBackForwardNavigation(url);
- navigationPolicy = WebNavigationPolicyIgnore;
- } else {
- bool isRedirect = ds->hasRedirectChain();
-
- WebNavigationType webnavType =
- WebDataSourceImpl::toWebNavigationType(action.type());
-
- RefPtr<Node> node;
- for (const Event* event = action.event(); event; event = event->underlyingEvent()) {
- if (event->isMouseEvent()) {
- const MouseEvent* mouseEvent =
- static_cast<const MouseEvent*>(event);
- node = m_webFrame->frame()->eventHandler()->hitTestResultAtPoint(
- mouseEvent->absoluteLocation(), false).innerNonSharedNode();
- break;
- }
- }
- WebNode originatingNode(node);
-
- navigationPolicy = m_webFrame->client()->decidePolicyForNavigation(
- m_webFrame, ds->request(), webnavType, originatingNode,
- navigationPolicy, isRedirect);
- }
- }
-
- if (navigationPolicy == WebNavigationPolicyCurrentTab)
- policyAction = PolicyUse;
- else if (navigationPolicy == WebNavigationPolicyDownload)
- policyAction = PolicyDownload;
- else {
- if (navigationPolicy != WebNavigationPolicyIgnore) {
- WrappedResourceRequest webreq(request);
- m_webFrame->client()->loadURLExternally(m_webFrame, webreq, navigationPolicy);
- }
- policyAction = PolicyIgnore;
- }
+ WebNavigationPolicy navigationPolicy = WebNavigationPolicyCurrentTab;
+ actionSpecifiesNavigationPolicy(action, &navigationPolicy);
+
+ // Give the delegate a chance to change the navigation policy.
+ const WebDataSourceImpl* ds = m_webFrame->provisionalDataSourceImpl();
+ if (ds) {
+ KURL url = ds->request().url();
+ ASSERT(!url.protocolIs(backForwardNavigationScheme));
+
+ bool isRedirect = ds->hasRedirectChain();
+
+ WebNavigationType webnavType =
+ WebDataSourceImpl::toWebNavigationType(action.type());
+
+ RefPtr<Node> node;
+ for (const Event* event = action.event(); event; event = event->underlyingEvent()) {
+ if (event->isMouseEvent()) {
+ const MouseEvent* mouseEvent =
+ static_cast<const MouseEvent*>(event);
+ node = m_webFrame->frame()->eventHandler()->hitTestResultAtPoint(
+ mouseEvent->absoluteLocation(), false).innerNonSharedNode();
+ break;
+ }
+ }
+ WebNode originatingNode(node);
+
+ navigationPolicy = m_webFrame->client()->decidePolicyForNavigation(
+ m_webFrame, ds->request(), webnavType, originatingNode,
+ navigationPolicy, isRedirect);
+ }
+
+ if (navigationPolicy == WebNavigationPolicyCurrentTab)
+ policyAction = PolicyUse;
+ else if (navigationPolicy == WebNavigationPolicyDownload)
+ policyAction = PolicyDownload;
+ else {
+ if (navigationPolicy != WebNavigationPolicyIgnore) {
+ WrappedResourceRequest webreq(request);
+ m_webFrame->client()->loadURLExternally(m_webFrame, webreq, navigationPolicy);
+ }
+ policyAction = PolicyIgnore;
+ }
}
(m_webFrame->frame()->loader()->policyChecker()->*function)(policyAction);
@@ -958,6 +966,12 @@ void FrameLoaderClientImpl::dispatchUnableToImplementPolicy(const ResourceError&
m_webFrame->client()->unableToImplementPolicyWithError(m_webFrame, error);
}
+void FrameLoaderClientImpl::dispatchWillSendSubmitEvent(HTMLFormElement* form)
+{
+ if (m_webFrame->client())
+ m_webFrame->client()->willSendSubmitEvent(m_webFrame, WebFormElement(form));
+}
+
void FrameLoaderClientImpl::dispatchWillSubmitForm(FramePolicyFunction function,
PassRefPtr<FormState> formState)
{
@@ -997,7 +1011,12 @@ void FrameLoaderClientImpl::postProgressStartedNotification()
void FrameLoaderClientImpl::postProgressEstimateChangedNotification()
{
- // FIXME
+ WebViewImpl* webview = m_webFrame->viewImpl();
+ if (webview && webview->client()) {
+ webview->client()->didChangeLoadProgress(
+ m_webFrame, m_webFrame->frame()->page()->progress()->estimatedProgress());
+ }
+
}
void FrameLoaderClientImpl::postProgressFinishedNotification()
@@ -1048,8 +1067,7 @@ void FrameLoaderClientImpl::committedLoad(DocumentLoader* loader, const char* da
// If we are sending data to MediaDocument, we should stop here
// and cancel the request.
- if (m_webFrame->frame()->document()
- && m_webFrame->frame()->document()->isMediaDocument())
+ if (m_webFrame->frame()->document()->isMediaDocument())
loader->cancelMainResourceLoad(pluginWillHandleLoadError(loader->response()));
// The plugin widget could have been created in the m_webFrame->DidReceiveData
@@ -1060,7 +1078,11 @@ void FrameLoaderClientImpl::committedLoad(DocumentLoader* loader, const char* da
m_pluginWidget->didReceiveResponse(
m_webFrame->frame()->loader()->activeDocumentLoader()->response());
}
- m_pluginWidget->didReceiveData(data, length);
+
+ // It's possible that the above call removed the pointer to the plugin, so
+ // check before calling it.
+ if (m_pluginWidget.get())
+ m_pluginWidget->didReceiveData(data, length);
}
}
@@ -1075,7 +1097,7 @@ void FrameLoaderClientImpl::finishedLoading(DocumentLoader* dl)
// However, we only want to do this if makeRepresentation has been called, to
// match the behavior on the Mac.
if (m_hasRepresentation)
- dl->frameLoader()->setEncoding("", false);
+ dl->frameLoader()->writer()->setEncoding("", false);
}
}
@@ -1087,10 +1109,28 @@ void FrameLoaderClientImpl::updateGlobalHistoryRedirectLinks()
{
}
-bool FrameLoaderClientImpl::shouldGoToHistoryItem(HistoryItem*) const
+bool FrameLoaderClientImpl::shouldGoToHistoryItem(HistoryItem* item) const
{
- // FIXME
- return true;
+ const KURL& url = item->url();
+ if (!url.protocolIs(backForwardNavigationScheme))
+ return true;
+
+ // Else, we'll punt this history navigation to the embedder. It is
+ // necessary that we intercept this here, well before the FrameLoader
+ // has made any state changes for this history traversal.
+
+ bool ok;
+ int offset = url.lastPathComponent().toIntStrict(&ok);
+ if (!ok) {
+ ASSERT_NOT_REACHED();
+ return false;
+ }
+
+ WebViewImpl* webview = m_webFrame->viewImpl();
+ if (webview->client())
+ webview->client()->navigateBackForwardSoon(offset);
+
+ return false;
}
void FrameLoaderClientImpl::dispatchDidAddBackForwardItem(HistoryItem*) const
@@ -1184,6 +1224,12 @@ bool FrameLoaderClientImpl::canHandleRequest(const ResourceRequest& request) con
m_webFrame, WrappedResourceRequest(request));
}
+bool FrameLoaderClientImpl::canShowMIMETypeAsHTML(const String& MIMEType) const
+{
+ notImplemented();
+ return false;
+}
+
bool FrameLoaderClientImpl::canShowMIMEType(const String& mimeType) const
{
// This method is called to determine if the media type can be shown
@@ -1302,6 +1348,10 @@ void FrameLoaderClientImpl::transitionToCommittedForNewPage()
makeDocumentView();
}
+void FrameLoaderClientImpl::dispatchDidBecomeFrameset(bool)
+{
+}
+
bool FrameLoaderClientImpl::canCachePage() const
{
// Since we manage the cache, always report this page as non-cacheable to
@@ -1332,6 +1382,28 @@ PassRefPtr<Frame> FrameLoaderClientImpl::createFrame(
return m_webFrame->createChildFrame(frameRequest, ownerElement);
}
+void FrameLoaderClientImpl::didTransferChildFrameToNewDocument(Page*)
+{
+ ASSERT(m_webFrame->frame()->ownerElement());
+
+ WebFrameImpl* newParent = static_cast<WebFrameImpl*>(m_webFrame->parent());
+ if (!newParent || !newParent->client())
+ return;
+
+ // Replace the client since the old client may be destroyed when the
+ // previous page is closed.
+ m_webFrame->setClient(newParent->client());
+}
+
+void FrameLoaderClientImpl::transferLoadingResourceFromPage(unsigned long identifier, DocumentLoader* loader, const ResourceRequest& request, Page* oldPage)
+{
+ assignIdentifierToInitialRequest(identifier, loader, request);
+
+ WebFrameImpl* oldWebFrame = WebFrameImpl::fromFrame(oldPage->mainFrame());
+ if (oldWebFrame && oldWebFrame->client())
+ oldWebFrame->client()->removeIdentifierForRequest(identifier);
+}
+
PassRefPtr<Widget> FrameLoaderClientImpl::createPlugin(
const IntSize& size, // FIXME: how do we use this?
HTMLPlugInElement* element,
@@ -1341,20 +1413,6 @@ PassRefPtr<Widget> FrameLoaderClientImpl::createPlugin(
const String& mimeType,
bool loadManually)
{
-#if !OS(WINDOWS)
- // WebCore asks us to make a plugin even if we don't have a
- // registered handler, with a comment saying it's so we can display
- // the broken plugin icon. In Chromium, we normally register a
- // fallback plugin handler that allows you to install a missing
- // plugin. Since we don't yet have a default plugin handler, we
- // need to return null here rather than going through all the
- // plugin-creation IPCs only to discover we don't have a plugin
- // registered, which causes a crash.
- // FIXME: remove me once we have a default plugin.
- if (objectContentType(url, mimeType) != ObjectContentNetscapePlugin)
- return 0;
-#endif
-
if (!m_webFrame->client())
return 0;
@@ -1387,7 +1445,8 @@ PassRefPtr<Widget> FrameLoaderClientImpl::createPlugin(
// (e.g., acrobat reader).
void FrameLoaderClientImpl::redirectDataToPlugin(Widget* pluginWidget)
{
- m_pluginWidget = static_cast<WebPluginContainerImpl*>(pluginWidget);
+ if (pluginWidget->isPluginContainer())
+ m_pluginWidget = static_cast<WebPluginContainerImpl*>(pluginWidget);
ASSERT(m_pluginWidget.get());
}
@@ -1452,34 +1511,40 @@ bool FrameLoaderClientImpl::actionSpecifiesNavigationPolicy(
const NavigationAction& action,
WebNavigationPolicy* policy)
{
- if ((action.type() != NavigationTypeLinkClicked) || !action.event()->isMouseEvent())
+ const MouseEvent* event = 0;
+ if (action.type() == NavigationTypeLinkClicked
+ && action.event()->isMouseEvent())
+ event = static_cast<const MouseEvent*>(action.event());
+ else if (action.type() == NavigationTypeFormSubmitted
+ && action.event()
+ && action.event()->underlyingEvent()
+ && action.event()->underlyingEvent()->isMouseEvent())
+ event = static_cast<const MouseEvent*>(action.event()->underlyingEvent());
+
+ if (!event)
return false;
- const MouseEvent* event = static_cast<const MouseEvent*>(action.event());
return WebViewImpl::navigationPolicyFromMouseEvent(
event->button(), event->ctrlKey(), event->shiftKey(), event->altKey(),
event->metaKey(), policy);
}
-void FrameLoaderClientImpl::handleBackForwardNavigation(const KURL& url)
-{
- ASSERT(url.protocolIs(backForwardNavigationScheme));
-
- bool ok;
- int offset = url.lastPathComponent().toIntStrict(&ok);
- if (!ok)
- return;
-
- WebViewImpl* webview = m_webFrame->viewImpl();
- if (webview->client())
- webview->client()->navigateBackForwardSoon(offset);
-}
-
PassOwnPtr<WebPluginLoadObserver> FrameLoaderClientImpl::pluginLoadObserver()
{
WebDataSourceImpl* ds = WebDataSourceImpl::fromDocumentLoader(
m_webFrame->frame()->loader()->activeDocumentLoader());
+ if (!ds) {
+ // We can arrive here if a popstate event handler detaches this frame.
+ // FIXME: Remove this code once http://webkit.org/b/36202 is fixed.
+ ASSERT(!m_webFrame->frame()->page());
+ return 0;
+ }
return ds->releasePluginLoadObserver();
}
+PassRefPtr<FrameNetworkingContext> FrameLoaderClientImpl::createNetworkingContext()
+{
+ return FrameNetworkingContextImpl::create(m_webFrame->frame());
+}
+
} // namespace WebKit