Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: third_party/WebKit/Source/web/WebLocalFrameImpl.cpp

Issue 1938753002: OOPIF: Replicate allowFullscreen flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after
1362 return WebString(frame()->layerTreeAsText(showDebugInfo ? LayerTreeIncludesD ebugInfo : LayerTreeNormal)); 1362 return WebString(frame()->layerTreeAsText(showDebugInfo ? LayerTreeIncludesD ebugInfo : LayerTreeNormal));
1363 } 1363 }
1364 1364
1365 // WebLocalFrameImpl public ---------------------------------------------------- ----- 1365 // WebLocalFrameImpl public ---------------------------------------------------- -----
1366 1366
1367 WebLocalFrame* WebLocalFrame::create(WebTreeScopeType scope, WebFrameClient* cli ent, WebFrame* opener) 1367 WebLocalFrame* WebLocalFrame::create(WebTreeScopeType scope, WebFrameClient* cli ent, WebFrame* opener)
1368 { 1368 {
1369 return WebLocalFrameImpl::create(scope, client, opener); 1369 return WebLocalFrameImpl::create(scope, client, opener);
1370 } 1370 }
1371 1371
1372 WebLocalFrame* WebLocalFrame::createProvisional(WebFrameClient* client, WebRemot eFrame* oldWebFrame, WebSandboxFlags flags, const WebFrameOwnerProperties& frame OwnerProperties) 1372 WebLocalFrame* WebLocalFrame::createProvisional(WebFrameClient* client, WebRemot eFrame* oldWebFrame, WebSandboxFlags flags)
1373 { 1373 {
1374 return WebLocalFrameImpl::createProvisional(client, oldWebFrame, flags, fram eOwnerProperties); 1374 return WebLocalFrameImpl::createProvisional(client, oldWebFrame, flags);
1375 } 1375 }
1376 1376
1377 WebLocalFrameImpl* WebLocalFrameImpl::create(WebTreeScopeType scope, WebFrameCli ent* client, WebFrame* opener) 1377 WebLocalFrameImpl* WebLocalFrameImpl::create(WebTreeScopeType scope, WebFrameCli ent* client, WebFrame* opener)
1378 { 1378 {
1379 WebLocalFrameImpl* frame = new WebLocalFrameImpl(scope, client); 1379 WebLocalFrameImpl* frame = new WebLocalFrameImpl(scope, client);
1380 frame->setOpener(opener); 1380 frame->setOpener(opener);
1381 return frame; 1381 return frame;
1382 } 1382 }
1383 1383
1384 WebLocalFrameImpl* WebLocalFrameImpl::createProvisional(WebFrameClient* client, WebRemoteFrame* oldWebFrame, WebSandboxFlags flags, const WebFrameOwnerPropertie s& frameOwnerProperties) 1384 WebLocalFrameImpl* WebLocalFrameImpl::createProvisional(WebFrameClient* client, WebRemoteFrame* oldWebFrame, WebSandboxFlags flags)
1385 { 1385 {
1386 WebLocalFrameImpl* webFrame = new WebLocalFrameImpl(oldWebFrame, client); 1386 WebLocalFrameImpl* webFrame = new WebLocalFrameImpl(oldWebFrame, client);
1387 Frame* oldFrame = oldWebFrame->toImplBase()->frame(); 1387 Frame* oldFrame = oldWebFrame->toImplBase()->frame();
1388 webFrame->setParent(oldWebFrame->parent()); 1388 webFrame->setParent(oldWebFrame->parent());
1389 webFrame->setOpener(oldWebFrame->opener()); 1389 webFrame->setOpener(oldWebFrame->opener());
1390 // Note: this *always* temporarily sets a frame owner, even for main frames! 1390 // Note: this *always* temporarily sets a frame owner, even for main frames!
1391 // When a core Frame is created with no owner, it attempts to set itself as 1391 // When a core Frame is created with no owner, it attempts to set itself as
1392 // the main frame of the Page. However, this is a provisional frame, and may 1392 // the main frame of the Page. However, this is a provisional frame, and may
1393 // disappear, so Page::m_mainFrame can't be updated just yet. 1393 // disappear, so Page::m_mainFrame can't be updated just yet.
1394 FrameOwner* tempOwner = DummyFrameOwner::create(); 1394 FrameOwner* tempOwner = DummyFrameOwner::create();
1395 // TODO(dcheng): This block is very similar to initializeCoreFrame. Try to r euse it here. 1395 // TODO(dcheng): This block is very similar to initializeCoreFrame. Try to r euse it here.
1396 LocalFrame* frame = LocalFrame::create(webFrame->m_frameLoaderClientImpl.get (), oldFrame->host(), tempOwner, client ? client->serviceRegistry() : nullptr); 1396 LocalFrame* frame = LocalFrame::create(webFrame->m_frameLoaderClientImpl.get (), oldFrame->host(), tempOwner, client ? client->serviceRegistry() : nullptr);
1397 // Set the name and unique name directly, bypassing any of the normal logic 1397 // Set the name and unique name directly, bypassing any of the normal logic
1398 // to calculate unique name. 1398 // to calculate unique name.
1399 frame->tree().setPrecalculatedName(toWebRemoteFrameImpl(oldWebFrame)->frame( )->tree().name(), toWebRemoteFrameImpl(oldWebFrame)->frame()->tree().uniqueName( )); 1399 frame->tree().setPrecalculatedName(toWebRemoteFrameImpl(oldWebFrame)->frame( )->tree().name(), toWebRemoteFrameImpl(oldWebFrame)->frame()->tree().uniqueName( ));
1400 webFrame->setCoreFrame(frame); 1400 webFrame->setCoreFrame(frame);
1401 1401
1402 frame->setOwner(oldFrame->owner()); 1402 frame->setOwner(oldFrame->owner());
1403 1403
1404 if (frame->owner() && frame->owner()->isRemote()) { 1404 if (frame->owner() && frame->owner()->isRemote())
1405 toRemoteFrameOwner(frame->owner())->setSandboxFlags(static_cast<SandboxF lags>(flags)); 1405 toRemoteFrameOwner(frame->owner())->setSandboxFlags(static_cast<SandboxF lags>(flags));
1406 // Since a remote frame doesn't get the notifications about frame owner
1407 // property modifications, we need to sync up those properties here.
1408 webFrame->setFrameOwnerProperties(frameOwnerProperties);
1409 }
1410 1406
1411 // We must call init() after m_frame is assigned because it is referenced 1407 // We must call init() after m_frame is assigned because it is referenced
1412 // during init(). Note that this may dispatch JS events; the frame may be 1408 // during init(). Note that this may dispatch JS events; the frame may be
1413 // detached after init() returns. 1409 // detached after init() returns.
1414 frame->init(); 1410 frame->init();
1415 return webFrame; 1411 return webFrame;
1416 } 1412 }
1417 1413
1418 WebLocalFrameImpl::WebLocalFrameImpl(WebTreeScopeType scope, WebFrameClient* cli ent) 1414 WebLocalFrameImpl::WebLocalFrameImpl(WebTreeScopeType scope, WebFrameClient* cli ent)
1419 : WebLocalFrame(scope) 1415 : WebLocalFrame(scope)
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1504 } 1500 }
1505 1501
1506 LocalFrame* WebLocalFrameImpl::createChildFrame(const FrameLoadRequest& request, 1502 LocalFrame* WebLocalFrameImpl::createChildFrame(const FrameLoadRequest& request,
1507 const AtomicString& name, HTMLFrameOwnerElement* ownerElement) 1503 const AtomicString& name, HTMLFrameOwnerElement* ownerElement)
1508 { 1504 {
1509 DCHECK(m_client); 1505 DCHECK(m_client);
1510 TRACE_EVENT0("blink", "WebLocalFrameImpl::createChildframe"); 1506 TRACE_EVENT0("blink", "WebLocalFrameImpl::createChildframe");
1511 WebTreeScopeType scope = frame()->document() == ownerElement->treeScope() 1507 WebTreeScopeType scope = frame()->document() == ownerElement->treeScope()
1512 ? WebTreeScopeType::Document 1508 ? WebTreeScopeType::Document
1513 : WebTreeScopeType::Shadow; 1509 : WebTreeScopeType::Shadow;
1514 WebFrameOwnerProperties ownerProperties(ownerElement->scrollingMode(), owner Element->marginWidth(), ownerElement->marginHeight()); 1510 WebFrameOwnerProperties ownerProperties(ownerElement->scrollingMode(), owner Element->marginWidth(), ownerElement->marginHeight(), ownerElement->allowFullscr een());
1515 // FIXME: Using subResourceAttributeName as fallback is not a perfect 1511 // FIXME: Using subResourceAttributeName as fallback is not a perfect
1516 // solution. subResourceAttributeName returns just one attribute name. The 1512 // solution. subResourceAttributeName returns just one attribute name. The
1517 // element might not have the attribute, and there might be other attributes 1513 // element might not have the attribute, and there might be other attributes
1518 // which can identify the element. 1514 // which can identify the element.
1519 AtomicString uniqueName = frame()->tree().calculateUniqueNameForNewChildFram e( 1515 AtomicString uniqueName = frame()->tree().calculateUniqueNameForNewChildFram e(
1520 name, ownerElement->getAttribute(ownerElement->subResourceAttributeName( ))); 1516 name, ownerElement->getAttribute(ownerElement->subResourceAttributeName( )));
1521 WebLocalFrameImpl* webframeChild = toWebLocalFrameImpl(m_client->createChild Frame(this, scope, name, uniqueName, static_cast<WebSandboxFlags>(ownerElement-> getSandboxFlags()), ownerProperties)); 1517 WebLocalFrameImpl* webframeChild = toWebLocalFrameImpl(m_client->createChild Frame(this, scope, name, uniqueName, static_cast<WebSandboxFlags>(ownerElement-> getSandboxFlags()), ownerProperties));
1522 if (!webframeChild) 1518 if (!webframeChild)
1523 return nullptr; 1519 return nullptr;
1524 1520
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1793 { 1789 {
1794 DCHECK(devToolsClient); 1790 DCHECK(devToolsClient);
1795 m_devToolsAgent = WebDevToolsAgentImpl::create(this, devToolsClient); 1791 m_devToolsAgent = WebDevToolsAgentImpl::create(this, devToolsClient);
1796 } 1792 }
1797 1793
1798 WebDevToolsAgent* WebLocalFrameImpl::devToolsAgent() 1794 WebDevToolsAgent* WebLocalFrameImpl::devToolsAgent()
1799 { 1795 {
1800 return m_devToolsAgent.get(); 1796 return m_devToolsAgent.get();
1801 } 1797 }
1802 1798
1803 void WebLocalFrameImpl::setFrameOwnerProperties(const WebFrameOwnerProperties& f rameOwnerProperties)
1804 {
1805 // At the moment, this is only used to replicate frame owner properties
1806 // for frames with a remote owner.
1807 FrameOwner* owner = frame()->owner();
1808 DCHECK(owner);
1809 toRemoteFrameOwner(owner)->setScrollingMode(frameOwnerProperties.scrollingMo de);
1810 toRemoteFrameOwner(owner)->setMarginWidth(frameOwnerProperties.marginWidth);
1811 toRemoteFrameOwner(owner)->setMarginHeight(frameOwnerProperties.marginHeight );
1812 }
1813
1814 WebLocalFrameImpl* WebLocalFrameImpl::localRoot() 1799 WebLocalFrameImpl* WebLocalFrameImpl::localRoot()
1815 { 1800 {
1816 // This can't use the LocalFrame::localFrameRoot, since it may be called 1801 // This can't use the LocalFrame::localFrameRoot, since it may be called
1817 // when the WebLocalFrame exists but the core LocalFrame does not. 1802 // when the WebLocalFrame exists but the core LocalFrame does not.
1818 // TODO(alexmos, dcheng): Clean this up to only calculate this in one place. 1803 // TODO(alexmos, dcheng): Clean this up to only calculate this in one place.
1819 WebLocalFrameImpl* localRoot = this; 1804 WebLocalFrameImpl* localRoot = this;
1820 while (!localRoot->frameWidget()) 1805 while (!localRoot->frameWidget())
1821 localRoot = toWebLocalFrameImpl(localRoot->parent()); 1806 localRoot = toWebLocalFrameImpl(localRoot->parent());
1822 return localRoot; 1807 return localRoot;
1823 } 1808 }
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
2106 return WebSandboxFlags::None; 2091 return WebSandboxFlags::None;
2107 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags( )); 2092 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags( ));
2108 } 2093 }
2109 2094
2110 void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags) 2095 void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags)
2111 { 2096 {
2112 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags)); 2097 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags));
2113 } 2098 }
2114 2099
2115 } // namespace blink 2100 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebLocalFrameImpl.h ('k') | third_party/WebKit/Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698