OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 #include "public/platform/WebSuspendableTask.h" | 194 #include "public/platform/WebSuspendableTask.h" |
195 #include "public/platform/WebURLError.h" | 195 #include "public/platform/WebURLError.h" |
196 #include "public/platform/WebVector.h" | 196 #include "public/platform/WebVector.h" |
197 #include "public/web/WebAutofillClient.h" | 197 #include "public/web/WebAutofillClient.h" |
198 #include "public/web/WebConsoleMessage.h" | 198 #include "public/web/WebConsoleMessage.h" |
199 #include "public/web/WebDOMEvent.h" | 199 #include "public/web/WebDOMEvent.h" |
200 #include "public/web/WebDocument.h" | 200 #include "public/web/WebDocument.h" |
201 #include "public/web/WebFindOptions.h" | 201 #include "public/web/WebFindOptions.h" |
202 #include "public/web/WebFormElement.h" | 202 #include "public/web/WebFormElement.h" |
203 #include "public/web/WebFrameClient.h" | 203 #include "public/web/WebFrameClient.h" |
| 204 #include "public/web/WebFrameOwnerProperties.h" |
204 #include "public/web/WebHistoryItem.h" | 205 #include "public/web/WebHistoryItem.h" |
205 #include "public/web/WebIconURL.h" | 206 #include "public/web/WebIconURL.h" |
206 #include "public/web/WebInputElement.h" | 207 #include "public/web/WebInputElement.h" |
207 #include "public/web/WebKit.h" | 208 #include "public/web/WebKit.h" |
208 #include "public/web/WebNode.h" | 209 #include "public/web/WebNode.h" |
209 #include "public/web/WebPerformance.h" | 210 #include "public/web/WebPerformance.h" |
210 #include "public/web/WebPlugin.h" | 211 #include "public/web/WebPlugin.h" |
211 #include "public/web/WebPrintParams.h" | 212 #include "public/web/WebPrintParams.h" |
212 #include "public/web/WebPrintPresetOptions.h" | 213 #include "public/web/WebPrintPresetOptions.h" |
213 #include "public/web/WebRange.h" | 214 #include "public/web/WebRange.h" |
(...skipping 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1734 return frame; | 1735 return frame; |
1735 } | 1736 } |
1736 | 1737 |
1737 PassRefPtrWillBeRawPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const Fra
meLoadRequest& request, | 1738 PassRefPtrWillBeRawPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const Fra
meLoadRequest& request, |
1738 const AtomicString& name, HTMLFrameOwnerElement* ownerElement) | 1739 const AtomicString& name, HTMLFrameOwnerElement* ownerElement) |
1739 { | 1740 { |
1740 ASSERT(m_client); | 1741 ASSERT(m_client); |
1741 WebTreeScopeType scope = frame()->document() == ownerElement->treeScope() | 1742 WebTreeScopeType scope = frame()->document() == ownerElement->treeScope() |
1742 ? WebTreeScopeType::Document | 1743 ? WebTreeScopeType::Document |
1743 : WebTreeScopeType::Shadow; | 1744 : WebTreeScopeType::Shadow; |
1744 WebLocalFrameImpl* webframeChild = toWebLocalFrameImpl(m_client->createChild
Frame(this, scope, name, static_cast<WebSandboxFlags>(ownerElement->sandboxFlags
()))); | 1745 WebFrameOwnerProperties ownerProperties(ownerElement->scrollingMode(), owner
Element->marginWidth(), ownerElement->marginHeight()); |
| 1746 WebLocalFrameImpl* webframeChild = toWebLocalFrameImpl(m_client->createChild
Frame(this, scope, name, static_cast<WebSandboxFlags>(ownerElement->sandboxFlags
()), ownerProperties)); |
1745 if (!webframeChild) | 1747 if (!webframeChild) |
1746 return nullptr; | 1748 return nullptr; |
1747 | 1749 |
1748 // FIXME: Using subResourceAttributeName as fallback is not a perfect | 1750 // FIXME: Using subResourceAttributeName as fallback is not a perfect |
1749 // solution. subResourceAttributeName returns just one attribute name. The | 1751 // solution. subResourceAttributeName returns just one attribute name. The |
1750 // element might not have the attribute, and there might be other attributes | 1752 // element might not have the attribute, and there might be other attributes |
1751 // which can identify the element. | 1753 // which can identify the element. |
1752 RefPtrWillBeRawPtr<LocalFrame> child = webframeChild->initializeCoreFrame(fr
ame()->host(), ownerElement, name, ownerElement->getAttribute(ownerElement->subR
esourceAttributeName())); | 1754 RefPtrWillBeRawPtr<LocalFrame> child = webframeChild->initializeCoreFrame(fr
ame()->host(), ownerElement, name, ownerElement->getAttribute(ownerElement->subR
esourceAttributeName())); |
1753 // Initializing the core frame may cause the new child to be detached, since | 1755 // Initializing the core frame may cause the new child to be detached, since |
1754 // it may dispatch a load event in the parent. | 1756 // it may dispatch a load event in the parent. |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1974 static void ensureFrameLoaderHasCommitted(FrameLoader& frameLoader) | 1976 static void ensureFrameLoaderHasCommitted(FrameLoader& frameLoader) |
1975 { | 1977 { |
1976 // Internally, Blink uses CommittedMultipleRealLoads to track whether the | 1978 // Internally, Blink uses CommittedMultipleRealLoads to track whether the |
1977 // next commit should create a new history item or not. Ensure we have | 1979 // next commit should create a new history item or not. Ensure we have |
1978 // reached that state. | 1980 // reached that state. |
1979 if (frameLoader.stateMachine()->committedMultipleRealLoads()) | 1981 if (frameLoader.stateMachine()->committedMultipleRealLoads()) |
1980 return; | 1982 return; |
1981 frameLoader.stateMachine()->advanceTo(FrameLoaderStateMachine::CommittedMult
ipleRealLoads); | 1983 frameLoader.stateMachine()->advanceTo(FrameLoaderStateMachine::CommittedMult
ipleRealLoads); |
1982 } | 1984 } |
1983 | 1985 |
1984 void WebLocalFrameImpl::initializeToReplaceRemoteFrame(WebRemoteFrame* oldWebFra
me, const WebString& name, WebSandboxFlags flags) | 1986 void WebLocalFrameImpl::initializeToReplaceRemoteFrame(WebRemoteFrame* oldWebFra
me, const WebString& name, WebSandboxFlags flags, const WebFrameOwnerProperties&
frameOwnerProperties) |
1985 { | 1987 { |
1986 Frame* oldFrame = toCoreFrame(oldWebFrame); | 1988 Frame* oldFrame = toCoreFrame(oldWebFrame); |
1987 // Note: this *always* temporarily sets a frame owner, even for main frames! | 1989 // Note: this *always* temporarily sets a frame owner, even for main frames! |
1988 // When a core Frame is created with no owner, it attempts to set itself as | 1990 // When a core Frame is created with no owner, it attempts to set itself as |
1989 // the main frame of the Page. However, this is a provisional frame, and may | 1991 // the main frame of the Page. However, this is a provisional frame, and may |
1990 // disappear, so Page::m_mainFrame can't be updated just yet. | 1992 // disappear, so Page::m_mainFrame can't be updated just yet. |
1991 OwnPtrWillBeRawPtr<FrameOwner> tempOwner = RemoteBridgeFrameOwner::create(nu
llptr, SandboxNone); | 1993 OwnPtrWillBeRawPtr<FrameOwner> tempOwner = RemoteBridgeFrameOwner::create(nu
llptr, SandboxNone, WebFrameOwnerProperties()); |
1992 RefPtrWillBeRawPtr<LocalFrame> frame = LocalFrame::create(m_frameLoaderClien
tImpl.get(), oldFrame->host(), tempOwner.get()); | 1994 RefPtrWillBeRawPtr<LocalFrame> frame = LocalFrame::create(m_frameLoaderClien
tImpl.get(), oldFrame->host(), tempOwner.get()); |
1993 frame->setOwner(oldFrame->owner()); | 1995 frame->setOwner(oldFrame->owner()); |
1994 if (frame->owner() && !frame->owner()->isLocal()) | |
1995 toRemoteBridgeFrameOwner(frame->owner())->setSandboxFlags(static_cast<Sa
ndboxFlags>(flags)); | |
1996 frame->tree().setName(name); | 1996 frame->tree().setName(name); |
1997 setParent(oldWebFrame->parent()); | 1997 setParent(oldWebFrame->parent()); |
1998 setOpener(oldWebFrame->opener()); | 1998 setOpener(oldWebFrame->opener()); |
1999 setCoreFrame(frame); | 1999 setCoreFrame(frame); |
| 2000 |
| 2001 if (frame->owner() && !frame->owner()->isLocal()) { |
| 2002 toRemoteBridgeFrameOwner(frame->owner())->setSandboxFlags(static_cast<Sa
ndboxFlags>(flags)); |
| 2003 // Since a remote frame doesn't get the notifications about frame owner |
| 2004 // property modifications, we need to sync up those properties here. |
| 2005 WebLocalFrameImpl::fromFrame(frame.get())->setFrameOwnerProperties(frame
OwnerProperties); |
| 2006 } |
| 2007 |
2000 // We must call init() after m_frame is assigned because it is referenced | 2008 // We must call init() after m_frame is assigned because it is referenced |
2001 // during init(). Note that this may dispatch JS events; the frame may be | 2009 // during init(). Note that this may dispatch JS events; the frame may be |
2002 // detached after init() returns. | 2010 // detached after init() returns. |
2003 frame->init(); | 2011 frame->init(); |
2004 } | 2012 } |
2005 | 2013 |
2006 void WebLocalFrameImpl::setAutofillClient(WebAutofillClient* autofillClient) | 2014 void WebLocalFrameImpl::setAutofillClient(WebAutofillClient* autofillClient) |
2007 { | 2015 { |
2008 m_autofillClient = autofillClient; | 2016 m_autofillClient = autofillClient; |
2009 } | 2017 } |
(...skipping 12 matching lines...) Expand all Loading... |
2022 m_devToolsAgent->dispose(); | 2030 m_devToolsAgent->dispose(); |
2023 m_devToolsAgent.clear(); | 2031 m_devToolsAgent.clear(); |
2024 } | 2032 } |
2025 } | 2033 } |
2026 | 2034 |
2027 WebDevToolsAgent* WebLocalFrameImpl::devToolsAgent() | 2035 WebDevToolsAgent* WebLocalFrameImpl::devToolsAgent() |
2028 { | 2036 { |
2029 return m_devToolsAgent.get(); | 2037 return m_devToolsAgent.get(); |
2030 } | 2038 } |
2031 | 2039 |
| 2040 void WebLocalFrameImpl::setFrameOwnerProperties(const WebFrameOwnerProperties& f
rameOwnerProperties) |
| 2041 { |
| 2042 // At the moment, this is only used to replicate frame owner properties |
| 2043 // for frames with a remote owner. |
| 2044 FrameOwner* owner = toCoreFrame(this)->owner(); |
| 2045 ASSERT(owner); |
| 2046 toRemoteBridgeFrameOwner(owner)->setScrollingMode(frameOwnerProperties.scrol
lingMode); |
| 2047 toRemoteBridgeFrameOwner(owner)->setMarginWidth(frameOwnerProperties.marginW
idth); |
| 2048 toRemoteBridgeFrameOwner(owner)->setMarginHeight(frameOwnerProperties.margin
Height); |
| 2049 } |
| 2050 |
2032 void WebLocalFrameImpl::sendPings(const WebNode& contextNode, const WebURL& dest
inationURL) | 2051 void WebLocalFrameImpl::sendPings(const WebNode& contextNode, const WebURL& dest
inationURL) |
2033 { | 2052 { |
2034 ASSERT(frame()); | 2053 ASSERT(frame()); |
2035 Element* anchor = contextNode.constUnwrap<Node>()->enclosingLinkEventParentO
rSelf(); | 2054 Element* anchor = contextNode.constUnwrap<Node>()->enclosingLinkEventParentO
rSelf(); |
2036 if (isHTMLAnchorElement(anchor)) | 2055 if (isHTMLAnchorElement(anchor)) |
2037 toHTMLAnchorElement(anchor)->sendPings(destinationURL); | 2056 toHTMLAnchorElement(anchor)->sendPings(destinationURL); |
2038 } | 2057 } |
2039 | 2058 |
2040 WebURLRequest WebLocalFrameImpl::requestFromHistoryItem(const WebHistoryItem& it
em, | 2059 WebURLRequest WebLocalFrameImpl::requestFromHistoryItem(const WebHistoryItem& it
em, |
2041 WebURLRequest::CachePolicy cachePolicy) const | 2060 WebURLRequest::CachePolicy cachePolicy) const |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2184 } | 2203 } |
2185 | 2204 |
2186 WebSandboxFlags WebLocalFrameImpl::effectiveSandboxFlags() const | 2205 WebSandboxFlags WebLocalFrameImpl::effectiveSandboxFlags() const |
2187 { | 2206 { |
2188 if (!frame()) | 2207 if (!frame()) |
2189 return WebSandboxFlags::None; | 2208 return WebSandboxFlags::None; |
2190 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags(
)); | 2209 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags(
)); |
2191 } | 2210 } |
2192 | 2211 |
2193 } // namespace blink | 2212 } // namespace blink |
OLD | NEW |