| 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 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1468 webFrame->setOpener(oldWebFrame->opener()); | 1468 webFrame->setOpener(oldWebFrame->opener()); |
| 1469 // Note: this *always* temporarily sets a frame owner, even for main frames! | 1469 // Note: this *always* temporarily sets a frame owner, even for main frames! |
| 1470 // When a core Frame is created with no owner, it attempts to set itself as | 1470 // When a core Frame is created with no owner, it attempts to set itself as |
| 1471 // the main frame of the Page. However, this is a provisional frame, and may | 1471 // the main frame of the Page. However, this is a provisional frame, and may |
| 1472 // disappear, so Page::m_mainFrame can't be updated just yet. | 1472 // disappear, so Page::m_mainFrame can't be updated just yet. |
| 1473 OwnPtrWillBeRawPtr<FrameOwner> tempOwner = RemoteBridgeFrameOwner::create(nu
llptr, SandboxNone, WebFrameOwnerProperties()); | 1473 OwnPtrWillBeRawPtr<FrameOwner> tempOwner = RemoteBridgeFrameOwner::create(nu
llptr, SandboxNone, WebFrameOwnerProperties()); |
| 1474 // TODO(dcheng): This block is very similar to initializeCoreFrame. Try to r
euse it here. | 1474 // TODO(dcheng): This block is very similar to initializeCoreFrame. Try to r
euse it here. |
| 1475 RefPtrWillBeRawPtr<LocalFrame> frame = LocalFrame::create(webFrame->m_frameL
oaderClientImpl.get(), oldFrame->host(), tempOwner.get()); | 1475 RefPtrWillBeRawPtr<LocalFrame> frame = LocalFrame::create(webFrame->m_frameL
oaderClientImpl.get(), oldFrame->host(), tempOwner.get()); |
| 1476 // Set the name and unique name directly, bypassing any of the normal logic | 1476 // Set the name and unique name directly, bypassing any of the normal logic |
| 1477 // to calculate unique name. | 1477 // to calculate unique name. |
| 1478 frame->tree().setNameForReplacementFrame(toWebRemoteFrameImpl(oldWebFrame)->
frame()->tree().name(), toWebRemoteFrameImpl(oldWebFrame)->frame()->tree().uniqu
eName()); | 1478 frame->tree().setPrecalculatedName(toWebRemoteFrameImpl(oldWebFrame)->frame(
)->tree().name(), toWebRemoteFrameImpl(oldWebFrame)->frame()->tree().uniqueName(
)); |
| 1479 webFrame->setCoreFrame(frame); | 1479 webFrame->setCoreFrame(frame); |
| 1480 | 1480 |
| 1481 frame->setOwner(oldFrame->owner()); | 1481 frame->setOwner(oldFrame->owner()); |
| 1482 | 1482 |
| 1483 if (frame->owner() && !frame->owner()->isLocal()) { | 1483 if (frame->owner() && !frame->owner()->isLocal()) { |
| 1484 toRemoteBridgeFrameOwner(frame->owner())->setSandboxFlags(static_cast<Sa
ndboxFlags>(flags)); | 1484 toRemoteBridgeFrameOwner(frame->owner())->setSandboxFlags(static_cast<Sa
ndboxFlags>(flags)); |
| 1485 // Since a remote frame doesn't get the notifications about frame owner | 1485 // Since a remote frame doesn't get the notifications about frame owner |
| 1486 // property modifications, we need to sync up those properties here. | 1486 // property modifications, we need to sync up those properties here. |
| 1487 webFrame->setFrameOwnerProperties(frameOwnerProperties); | 1487 webFrame->setFrameOwnerProperties(frameOwnerProperties); |
| 1488 } | 1488 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1584 USBController::provideTo(*m_frame, m_client ? m_client->usbClient()
: nullptr); | 1584 USBController::provideTo(*m_frame, m_client ? m_client->usbClient()
: nullptr); |
| 1585 if (RuntimeEnabledFeatures::webVREnabled()) | 1585 if (RuntimeEnabledFeatures::webVREnabled()) |
| 1586 VRController::provideTo(*m_frame, m_client ? m_client->webVRClient()
: nullptr); | 1586 VRController::provideTo(*m_frame, m_client ? m_client->webVRClient()
: nullptr); |
| 1587 if (RuntimeEnabledFeatures::wakeLockEnabled()) | 1587 if (RuntimeEnabledFeatures::wakeLockEnabled()) |
| 1588 ScreenWakeLock::provideTo(*m_frame, m_client ? m_client->wakeLockCli
ent() : nullptr); | 1588 ScreenWakeLock::provideTo(*m_frame, m_client ? m_client->wakeLockCli
ent() : nullptr); |
| 1589 if (RuntimeEnabledFeatures::audioOutputDevicesEnabled()) | 1589 if (RuntimeEnabledFeatures::audioOutputDevicesEnabled()) |
| 1590 provideAudioOutputDeviceClientTo(*m_frame, AudioOutputDeviceClientIm
pl::create()); | 1590 provideAudioOutputDeviceClientTo(*m_frame, AudioOutputDeviceClientIm
pl::create()); |
| 1591 } | 1591 } |
| 1592 } | 1592 } |
| 1593 | 1593 |
| 1594 void WebLocalFrameImpl::initializeCoreFrame(FrameHost* host, FrameOwner* owner,
const AtomicString& name, const AtomicString& fallbackName) | 1594 void WebLocalFrameImpl::initializeCoreFrame(FrameHost* host, FrameOwner* owner,
const AtomicString& name, const AtomicString& uniqueName) |
| 1595 { | 1595 { |
| 1596 setCoreFrame(LocalFrame::create(m_frameLoaderClientImpl.get(), host, owner))
; | 1596 setCoreFrame(LocalFrame::create(m_frameLoaderClientImpl.get(), host, owner))
; |
| 1597 frame()->tree().setName(name, fallbackName); | 1597 frame()->tree().setPrecalculatedName(name, uniqueName); |
| 1598 // We must call init() after m_frame is assigned because it is referenced | 1598 // We must call init() after m_frame is assigned because it is referenced |
| 1599 // during init(). Note that this may dispatch JS events; the frame may be | 1599 // during init(). Note that this may dispatch JS events; the frame may be |
| 1600 // detached after init() returns. | 1600 // detached after init() returns. |
| 1601 frame()->init(); | 1601 frame()->init(); |
| 1602 } | 1602 } |
| 1603 | 1603 |
| 1604 PassRefPtrWillBeRawPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const Fra
meLoadRequest& request, | 1604 PassRefPtrWillBeRawPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const Fra
meLoadRequest& request, |
| 1605 const AtomicString& name, HTMLFrameOwnerElement* ownerElement) | 1605 const AtomicString& name, HTMLFrameOwnerElement* ownerElement) |
| 1606 { | 1606 { |
| 1607 ASSERT(m_client); | 1607 ASSERT(m_client); |
| 1608 TRACE_EVENT0("blink", "WebLocalFrameImpl::createChildframe"); | 1608 TRACE_EVENT0("blink", "WebLocalFrameImpl::createChildframe"); |
| 1609 WebTreeScopeType scope = frame()->document() == ownerElement->treeScope() | 1609 WebTreeScopeType scope = frame()->document() == ownerElement->treeScope() |
| 1610 ? WebTreeScopeType::Document | 1610 ? WebTreeScopeType::Document |
| 1611 : WebTreeScopeType::Shadow; | 1611 : WebTreeScopeType::Shadow; |
| 1612 WebFrameOwnerProperties ownerProperties(ownerElement->scrollingMode(), owner
Element->marginWidth(), ownerElement->marginHeight()); | 1612 WebFrameOwnerProperties ownerProperties(ownerElement->scrollingMode(), owner
Element->marginWidth(), ownerElement->marginHeight()); |
| 1613 RefPtrWillBeRawPtr<WebLocalFrameImpl> webframeChild = toWebLocalFrameImpl(m_
client->createChildFrame(this, scope, name, static_cast<WebSandboxFlags>(ownerEl
ement->sandboxFlags()), ownerProperties)); | |
| 1614 if (!webframeChild) | |
| 1615 return nullptr; | |
| 1616 | |
| 1617 // FIXME: Using subResourceAttributeName as fallback is not a perfect | 1613 // FIXME: Using subResourceAttributeName as fallback is not a perfect |
| 1618 // solution. subResourceAttributeName returns just one attribute name. The | 1614 // solution. subResourceAttributeName returns just one attribute name. The |
| 1619 // element might not have the attribute, and there might be other attributes | 1615 // element might not have the attribute, and there might be other attributes |
| 1620 // which can identify the element. | 1616 // which can identify the element. |
| 1621 webframeChild->initializeCoreFrame(frame()->host(), ownerElement, name, owne
rElement->getAttribute(ownerElement->subResourceAttributeName())); | 1617 AtomicString uniqueName = frame()->tree().calculateUniqueNameForNewChildFram
e( |
| 1618 name, ownerElement->getAttribute(ownerElement->subResourceAttributeName(
))); |
| 1619 RefPtrWillBeRawPtr<WebLocalFrameImpl> webframeChild = toWebLocalFrameImpl(m_
client->createChildFrame(this, scope, name, uniqueName, static_cast<WebSandboxFl
ags>(ownerElement->sandboxFlags()), ownerProperties)); |
| 1620 if (!webframeChild) |
| 1621 return nullptr; |
| 1622 |
| 1623 webframeChild->initializeCoreFrame(frame()->host(), ownerElement, name, uniq
ueName); |
| 1622 // Initializing the core frame may cause the new child to be detached, since | 1624 // Initializing the core frame may cause the new child to be detached, since |
| 1623 // it may dispatch a load event in the parent. | 1625 // it may dispatch a load event in the parent. |
| 1624 if (!webframeChild->parent()) | 1626 if (!webframeChild->parent()) |
| 1625 return nullptr; | 1627 return nullptr; |
| 1626 | 1628 |
| 1627 // If we're moving in the back/forward list, we might want to replace the co
ntent | 1629 // If we're moving in the back/forward list, we might want to replace the co
ntent |
| 1628 // of this child frame with whatever was there at that point. | 1630 // of this child frame with whatever was there at that point. |
| 1629 RefPtrWillBeRawPtr<HistoryItem> childItem = nullptr; | 1631 RefPtrWillBeRawPtr<HistoryItem> childItem = nullptr; |
| 1630 if (isBackForwardLoadType(frame()->loader().loadType()) && !frame()->documen
t()->loadEventFinished()) | 1632 if (isBackForwardLoadType(frame()->loader().loadType()) && !frame()->documen
t()->loadEventFinished()) |
| 1631 childItem = PassRefPtrWillBeRawPtr<HistoryItem>(webframeChild->client()-
>historyItemForNewChildFrame()); | 1633 childItem = PassRefPtrWillBeRawPtr<HistoryItem>(webframeChild->client()-
>historyItemForNewChildFrame()); |
| (...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2184 return WebSandboxFlags::None; | 2186 return WebSandboxFlags::None; |
| 2185 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags(
)); | 2187 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags(
)); |
| 2186 } | 2188 } |
| 2187 | 2189 |
| 2188 void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags) | 2190 void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags) |
| 2189 { | 2191 { |
| 2190 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags)); | 2192 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags)); |
| 2191 } | 2193 } |
| 2192 | 2194 |
| 2193 } // namespace blink | 2195 } // namespace blink |
| OLD | NEW |