Chromium Code Reviews| 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().setReplicatedName(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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1577 USBController::provideTo(*m_frame, m_client ? m_client->usbClient() : nullptr); | 1577 USBController::provideTo(*m_frame, m_client ? m_client->usbClient() : nullptr); | 
| 1578 if (RuntimeEnabledFeatures::webVREnabled()) | 1578 if (RuntimeEnabledFeatures::webVREnabled()) | 
| 1579 VRController::provideTo(*m_frame, m_client ? m_client->webVRClient() : nullptr); | 1579 VRController::provideTo(*m_frame, m_client ? m_client->webVRClient() : nullptr); | 
| 1580 if (RuntimeEnabledFeatures::wakeLockEnabled()) | 1580 if (RuntimeEnabledFeatures::wakeLockEnabled()) | 
| 1581 ScreenWakeLock::provideTo(*m_frame, m_client ? m_client->wakeLockCli ent() : nullptr); | 1581 ScreenWakeLock::provideTo(*m_frame, m_client ? m_client->wakeLockCli ent() : nullptr); | 
| 1582 if (RuntimeEnabledFeatures::audioOutputDevicesEnabled()) | 1582 if (RuntimeEnabledFeatures::audioOutputDevicesEnabled()) | 
| 1583 provideAudioOutputDeviceClientTo(*m_frame, AudioOutputDeviceClientIm pl::create()); | 1583 provideAudioOutputDeviceClientTo(*m_frame, AudioOutputDeviceClientIm pl::create()); | 
| 1584 } | 1584 } | 
| 1585 } | 1585 } | 
| 1586 | 1586 | 
| 1587 void WebLocalFrameImpl::initializeCoreFrame(FrameHost* host, FrameOwner* owner, const AtomicString& name, const AtomicString& fallbackName) | 1587 void WebLocalFrameImpl::initializeCoreFrame(FrameHost* host, FrameOwner* owner, const AtomicString& name, const AtomicString& uniqueName) | 
| 1588 { | 1588 { | 
| 1589 setCoreFrame(LocalFrame::create(m_frameLoaderClientImpl.get(), host, owner)) ; | 1589 setCoreFrame(LocalFrame::create(m_frameLoaderClientImpl.get(), host, owner)) ; | 
| 1590 frame()->tree().setName(name, fallbackName); | 1590 frame()->tree().setReplicatedName(name, uniqueName); | 
| 
 
dcheng
2016/02/16 22:17:29
This isn't really setting the replicated name thou
 
Łukasz Anforowicz
2016/02/16 23:39:53
Good point - I wasn't quite happy about setReplica
 
 | |
| 1591 // We must call init() after m_frame is assigned because it is referenced | 1591 // We must call init() after m_frame is assigned because it is referenced | 
| 1592 // during init(). Note that this may dispatch JS events; the frame may be | 1592 // during init(). Note that this may dispatch JS events; the frame may be | 
| 1593 // detached after init() returns. | 1593 // detached after init() returns. | 
| 1594 frame()->init(); | 1594 frame()->init(); | 
| 1595 } | 1595 } | 
| 1596 | 1596 | 
| 1597 PassRefPtrWillBeRawPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const Fra meLoadRequest& request, | 1597 PassRefPtrWillBeRawPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const Fra meLoadRequest& request, | 
| 1598 const AtomicString& name, HTMLFrameOwnerElement* ownerElement) | 1598 const AtomicString& name, HTMLFrameOwnerElement* ownerElement) | 
| 1599 { | 1599 { | 
| 1600 ASSERT(m_client); | 1600 ASSERT(m_client); | 
| 1601 TRACE_EVENT0("blink", "WebLocalFrameImpl::createChildframe"); | 1601 TRACE_EVENT0("blink", "WebLocalFrameImpl::createChildframe"); | 
| 1602 WebTreeScopeType scope = frame()->document() == ownerElement->treeScope() | 1602 WebTreeScopeType scope = frame()->document() == ownerElement->treeScope() | 
| 1603 ? WebTreeScopeType::Document | 1603 ? WebTreeScopeType::Document | 
| 1604 : WebTreeScopeType::Shadow; | 1604 : WebTreeScopeType::Shadow; | 
| 1605 WebFrameOwnerProperties ownerProperties(ownerElement->scrollingMode(), owner Element->marginWidth(), ownerElement->marginHeight()); | 1605 WebFrameOwnerProperties ownerProperties(ownerElement->scrollingMode(), owner Element->marginWidth(), ownerElement->marginHeight()); | 
| 1606 RefPtrWillBeRawPtr<WebLocalFrameImpl> webframeChild = toWebLocalFrameImpl(m_ client->createChildFrame(this, scope, name, static_cast<WebSandboxFlags>(ownerEl ement->sandboxFlags()), ownerProperties)); | 1606 AtomicString uniqueName = frame()->tree().calculateUniqueNameForNewChildFram e( | 
| 1607 name, ownerElement->getAttribute(ownerElement->subResourceAttributeName( ))); | |
| 1608 RefPtrWillBeRawPtr<WebLocalFrameImpl> webframeChild = toWebLocalFrameImpl(m_ client->createChildFrame(this, scope, name, uniqueName, static_cast<WebSandboxFl ags>(ownerElement->sandboxFlags()), ownerProperties)); | |
| 1607 if (!webframeChild) | 1609 if (!webframeChild) | 
| 1608 return nullptr; | 1610 return nullptr; | 
| 1609 | 1611 | 
| 1610 // FIXME: Using subResourceAttributeName as fallback is not a perfect | 1612 // FIXME: Using subResourceAttributeName as fallback is not a perfect | 
| 
 
dcheng
2016/02/16 22:17:29
Move this FIXME to line 1606?
 
Łukasz Anforowicz
2016/02/16 23:39:53
Ooops.  Done.
 
 | |
| 1611 // solution. subResourceAttributeName returns just one attribute name. The | 1613 // solution. subResourceAttributeName returns just one attribute name. The | 
| 1612 // element might not have the attribute, and there might be other attributes | 1614 // element might not have the attribute, and there might be other attributes | 
| 1613 // which can identify the element. | 1615 // which can identify the element. | 
| 1614 webframeChild->initializeCoreFrame(frame()->host(), ownerElement, name, owne rElement->getAttribute(ownerElement->subResourceAttributeName())); | 1616 webframeChild->initializeCoreFrame(frame()->host(), ownerElement, name, uniq ueName); | 
| 1615 // Initializing the core frame may cause the new child to be detached, since | 1617 // Initializing the core frame may cause the new child to be detached, since | 
| 1616 // it may dispatch a load event in the parent. | 1618 // it may dispatch a load event in the parent. | 
| 1617 if (!webframeChild->parent()) | 1619 if (!webframeChild->parent()) | 
| 1618 return nullptr; | 1620 return nullptr; | 
| 1619 | 1621 | 
| 1620 // If we're moving in the back/forward list, we might want to replace the co ntent | 1622 // If we're moving in the back/forward list, we might want to replace the co ntent | 
| 1621 // of this child frame with whatever was there at that point. | 1623 // of this child frame with whatever was there at that point. | 
| 1622 RefPtrWillBeRawPtr<HistoryItem> childItem = nullptr; | 1624 RefPtrWillBeRawPtr<HistoryItem> childItem = nullptr; | 
| 1623 if (isBackForwardLoadType(frame()->loader().loadType()) && !frame()->documen t()->loadEventFinished()) | 1625 if (isBackForwardLoadType(frame()->loader().loadType()) && !frame()->documen t()->loadEventFinished()) | 
| 1624 childItem = PassRefPtrWillBeRawPtr<HistoryItem>(webframeChild->client()- >historyItemForNewChildFrame()); | 1626 childItem = PassRefPtrWillBeRawPtr<HistoryItem>(webframeChild->client()- >historyItemForNewChildFrame()); | 
| (...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2177 return WebSandboxFlags::None; | 2179 return WebSandboxFlags::None; | 
| 2178 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags( )); | 2180 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags( )); | 
| 2179 } | 2181 } | 
| 2180 | 2182 | 
| 2181 void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags) | 2183 void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags) | 
| 2182 { | 2184 { | 
| 2183 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags)); | 2185 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags)); | 
| 2184 } | 2186 } | 
| 2185 | 2187 | 
| 2186 } // namespace blink | 2188 } // namespace blink | 
| OLD | NEW |