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 1745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1756 USBController::provideTo(*m_frame, m_client ? m_client->usbClient()
: nullptr); | 1756 USBController::provideTo(*m_frame, m_client ? m_client->usbClient()
: nullptr); |
1757 if (RuntimeEnabledFeatures::webVREnabled()) | 1757 if (RuntimeEnabledFeatures::webVREnabled()) |
1758 VRController::provideTo(*m_frame, m_client ? m_client->webVRClient()
: nullptr); | 1758 VRController::provideTo(*m_frame, m_client ? m_client->webVRClient()
: nullptr); |
1759 if (RuntimeEnabledFeatures::wakeLockEnabled()) | 1759 if (RuntimeEnabledFeatures::wakeLockEnabled()) |
1760 ScreenWakeLock::provideTo(*m_frame, m_client ? m_client->wakeLockCli
ent() : nullptr); | 1760 ScreenWakeLock::provideTo(*m_frame, m_client ? m_client->wakeLockCli
ent() : nullptr); |
1761 if (RuntimeEnabledFeatures::audioOutputDevicesEnabled()) | 1761 if (RuntimeEnabledFeatures::audioOutputDevicesEnabled()) |
1762 provideAudioOutputDeviceClientTo(*m_frame, AudioOutputDeviceClientIm
pl::create()); | 1762 provideAudioOutputDeviceClientTo(*m_frame, AudioOutputDeviceClientIm
pl::create()); |
1763 } | 1763 } |
1764 } | 1764 } |
1765 | 1765 |
1766 void WebLocalFrameImpl::initializeCoreFrame(FrameHost* host, FrameOwner* owner,
const AtomicString& name, const AtomicString& fallbackName) | 1766 void WebLocalFrameImpl::initializeCoreFrame(FrameHost* host, FrameOwner* owner,
const AtomicString& name, const AtomicString& fallbackName, const AtomicString&
uniqueName) |
1767 { | 1767 { |
1768 setCoreFrame(LocalFrame::create(m_frameLoaderClientImpl.get(), host, owner))
; | 1768 setCoreFrame(LocalFrame::create(m_frameLoaderClientImpl.get(), host, owner))
; |
1769 frame()->tree().setName(name, fallbackName); | 1769 if (uniqueName.isEmpty()) { |
| 1770 frame()->tree().setName(name, fallbackName); |
| 1771 } else { |
| 1772 frame()->tree().setNameForReplacementFrame(name, uniqueName); |
| 1773 } |
1770 // We must call init() after m_frame is assigned because it is referenced | 1774 // We must call init() after m_frame is assigned because it is referenced |
1771 // during init(). Note that this may dispatch JS events; the frame may be | 1775 // during init(). Note that this may dispatch JS events; the frame may be |
1772 // detached after init() returns. | 1776 // detached after init() returns. |
1773 frame()->init(); | 1777 frame()->init(); |
1774 } | 1778 } |
1775 | 1779 |
1776 PassRefPtrWillBeRawPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const Fra
meLoadRequest& request, | 1780 PassRefPtrWillBeRawPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const Fra
meLoadRequest& request, |
1777 const AtomicString& name, HTMLFrameOwnerElement* ownerElement) | 1781 const AtomicString& name, HTMLFrameOwnerElement* ownerElement) |
1778 { | 1782 { |
1779 ASSERT(m_client); | 1783 ASSERT(m_client); |
1780 TRACE_EVENT0("blink", "WebLocalFrameImpl::createChildframe"); | 1784 TRACE_EVENT0("blink", "WebLocalFrameImpl::createChildframe"); |
1781 WebTreeScopeType scope = frame()->document() == ownerElement->treeScope() | 1785 WebTreeScopeType scope = frame()->document() == ownerElement->treeScope() |
1782 ? WebTreeScopeType::Document | 1786 ? WebTreeScopeType::Document |
1783 : WebTreeScopeType::Shadow; | 1787 : WebTreeScopeType::Shadow; |
1784 WebFrameOwnerProperties ownerProperties(ownerElement->scrollingMode(), owner
Element->marginWidth(), ownerElement->marginHeight()); | 1788 WebFrameOwnerProperties ownerProperties(ownerElement->scrollingMode(), owner
Element->marginWidth(), ownerElement->marginHeight()); |
1785 RefPtrWillBeRawPtr<WebLocalFrameImpl> webframeChild = toWebLocalFrameImpl(m_
client->createChildFrame(this, scope, name, static_cast<WebSandboxFlags>(ownerEl
ement->sandboxFlags()), ownerProperties)); | 1789 AtomicString fallbackName = ownerElement->getAttribute(ownerElement->subReso
urceAttributeName()); |
| 1790 AtomicString uniqueName = frame()->tree().calculateUniqueNameForNewChildFram
e(name, fallbackName); |
| 1791 RefPtrWillBeRawPtr<WebLocalFrameImpl> webframeChild = toWebLocalFrameImpl(m_
client->createChildFrame(this, scope, name, uniqueName, static_cast<WebSandboxFl
ags>(ownerElement->sandboxFlags()), ownerProperties)); |
1786 if (!webframeChild) | 1792 if (!webframeChild) |
1787 return nullptr; | 1793 return nullptr; |
1788 | 1794 |
1789 // FIXME: Using subResourceAttributeName as fallback is not a perfect | 1795 // FIXME: Using subResourceAttributeName as fallback is not a perfect |
1790 // solution. subResourceAttributeName returns just one attribute name. The | 1796 // solution. subResourceAttributeName returns just one attribute name. The |
1791 // element might not have the attribute, and there might be other attributes | 1797 // element might not have the attribute, and there might be other attributes |
1792 // which can identify the element. | 1798 // which can identify the element. |
1793 webframeChild->initializeCoreFrame(frame()->host(), ownerElement, name, owne
rElement->getAttribute(ownerElement->subResourceAttributeName())); | 1799 webframeChild->initializeCoreFrame(frame()->host(), ownerElement, name, fall
backName, uniqueName); |
1794 // Initializing the core frame may cause the new child to be detached, since | 1800 // Initializing the core frame may cause the new child to be detached, since |
1795 // it may dispatch a load event in the parent. | 1801 // it may dispatch a load event in the parent. |
1796 if (!webframeChild->parent()) | 1802 if (!webframeChild->parent()) |
1797 return nullptr; | 1803 return nullptr; |
1798 | 1804 |
1799 // If we're moving in the back/forward list, we might want to replace the co
ntent | 1805 // If we're moving in the back/forward list, we might want to replace the co
ntent |
1800 // of this child frame with whatever was there at that point. | 1806 // of this child frame with whatever was there at that point. |
1801 RefPtrWillBeRawPtr<HistoryItem> childItem = nullptr; | 1807 RefPtrWillBeRawPtr<HistoryItem> childItem = nullptr; |
1802 if (isBackForwardLoadType(frame()->loader().loadType()) && !frame()->documen
t()->loadEventFinished()) | 1808 if (isBackForwardLoadType(frame()->loader().loadType()) && !frame()->documen
t()->loadEventFinished()) |
1803 childItem = PassRefPtrWillBeRawPtr<HistoryItem>(webframeChild->client()-
>historyItemForNewChildFrame()); | 1809 childItem = PassRefPtrWillBeRawPtr<HistoryItem>(webframeChild->client()-
>historyItemForNewChildFrame()); |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2255 return WebSandboxFlags::None; | 2261 return WebSandboxFlags::None; |
2256 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags(
)); | 2262 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags(
)); |
2257 } | 2263 } |
2258 | 2264 |
2259 void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags) | 2265 void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags) |
2260 { | 2266 { |
2261 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags)); | 2267 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags)); |
2262 } | 2268 } |
2263 | 2269 |
2264 } // namespace blink | 2270 } // namespace blink |
OLD | NEW |