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

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

Issue 1830883002: Add blink::ServiceRegistry and expose it from LocalFrame and Platform. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 1393 matching lines...) Expand 10 before | Expand all | Expand 10 after
1404 WebString WebLocalFrameImpl::layerTreeAsText(bool showDebugInfo) const 1404 WebString WebLocalFrameImpl::layerTreeAsText(bool showDebugInfo) const
1405 { 1405 {
1406 if (!frame()) 1406 if (!frame())
1407 return WebString(); 1407 return WebString();
1408 1408
1409 return WebString(frame()->layerTreeAsText(showDebugInfo ? LayerTreeIncludesD ebugInfo : LayerTreeNormal)); 1409 return WebString(frame()->layerTreeAsText(showDebugInfo ? LayerTreeIncludesD ebugInfo : LayerTreeNormal));
1410 } 1410 }
1411 1411
1412 // WebLocalFrameImpl public ---------------------------------------------------- ----- 1412 // WebLocalFrameImpl public ---------------------------------------------------- -----
1413 1413
1414 WebLocalFrame* WebLocalFrame::create(WebTreeScopeType scope, WebFrameClient* cli ent, WebFrame* opener) 1414 WebLocalFrame* WebLocalFrame::create(WebTreeScopeType scope, WebFrameClient* cli ent, WebFrame* opener, ServiceRegistry* serviceRegistry)
1415 { 1415 {
1416 return WebLocalFrameImpl::create(scope, client, opener); 1416 return WebLocalFrameImpl::create(scope, client, opener, serviceRegistry);
1417 } 1417 }
1418 1418
1419 WebLocalFrame* WebLocalFrame::createProvisional(WebFrameClient* client, WebRemot eFrame* oldWebFrame, WebSandboxFlags flags, const WebFrameOwnerProperties& frame OwnerProperties) 1419 WebLocalFrame* WebLocalFrame::createProvisional(WebFrameClient* client, WebRemot eFrame* oldWebFrame, WebSandboxFlags flags, const WebFrameOwnerProperties& frame OwnerProperties, ServiceRegistry* serviceRegistry)
1420 { 1420 {
1421 return WebLocalFrameImpl::createProvisional(client, oldWebFrame, flags, fram eOwnerProperties); 1421 return WebLocalFrameImpl::createProvisional(client, oldWebFrame, flags, fram eOwnerProperties, serviceRegistry);
1422 } 1422 }
1423 1423
1424 WebLocalFrameImpl* WebLocalFrameImpl::create(WebTreeScopeType scope, WebFrameCli ent* client, WebFrame* opener) 1424 WebLocalFrameImpl* WebLocalFrameImpl::create(WebTreeScopeType scope, WebFrameCli ent* client, WebFrame* opener, ServiceRegistry* serviceRegistry)
1425 { 1425 {
1426 WebLocalFrameImpl* frame = new WebLocalFrameImpl(scope, client); 1426 WebLocalFrameImpl* frame = new WebLocalFrameImpl(scope, client, serviceRegis try);
1427 frame->setOpener(opener); 1427 frame->setOpener(opener);
1428 #if ENABLE(OILPAN) 1428 #if ENABLE(OILPAN)
1429 return frame; 1429 return frame;
1430 #else 1430 #else
1431 return adoptRef(frame).leakRef(); 1431 return adoptRef(frame).leakRef();
1432 #endif 1432 #endif
1433 } 1433 }
1434 1434
1435 WebLocalFrameImpl* WebLocalFrameImpl::createProvisional(WebFrameClient* client, WebRemoteFrame* oldWebFrame, WebSandboxFlags flags, const WebFrameOwnerPropertie s& frameOwnerProperties) 1435 WebLocalFrameImpl* WebLocalFrameImpl::createProvisional(WebFrameClient* client, WebRemoteFrame* oldWebFrame, WebSandboxFlags flags, const WebFrameOwnerPropertie s& frameOwnerProperties, ServiceRegistry* serviceRegistry)
1436 { 1436 {
1437 RefPtrWillBeRawPtr<WebLocalFrameImpl> webFrame = adoptRefWillBeNoop(new WebL ocalFrameImpl(oldWebFrame, client)); 1437 RefPtrWillBeRawPtr<WebLocalFrameImpl> webFrame = adoptRefWillBeNoop(new WebL ocalFrameImpl(oldWebFrame, client, serviceRegistry));
1438 Frame* oldFrame = oldWebFrame->toImplBase()->frame(); 1438 Frame* oldFrame = oldWebFrame->toImplBase()->frame();
1439 webFrame->setParent(oldWebFrame->parent()); 1439 webFrame->setParent(oldWebFrame->parent());
1440 webFrame->setOpener(oldWebFrame->opener()); 1440 webFrame->setOpener(oldWebFrame->opener());
1441 // Note: this *always* temporarily sets a frame owner, even for main frames! 1441 // Note: this *always* temporarily sets a frame owner, even for main frames!
1442 // When a core Frame is created with no owner, it attempts to set itself as 1442 // When a core Frame is created with no owner, it attempts to set itself as
1443 // the main frame of the Page. However, this is a provisional frame, and may 1443 // the main frame of the Page. However, this is a provisional frame, and may
1444 // disappear, so Page::m_mainFrame can't be updated just yet. 1444 // disappear, so Page::m_mainFrame can't be updated just yet.
1445 OwnPtrWillBeRawPtr<FrameOwner> tempOwner = DummyFrameOwner::create(); 1445 OwnPtrWillBeRawPtr<FrameOwner> tempOwner = DummyFrameOwner::create();
1446 // TODO(dcheng): This block is very similar to initializeCoreFrame. Try to r euse it here. 1446 // TODO(dcheng): This block is very similar to initializeCoreFrame. Try to r euse it here.
1447 RefPtrWillBeRawPtr<LocalFrame> frame = LocalFrame::create(webFrame->m_frameL oaderClientImpl.get(), oldFrame->host(), tempOwner.get()); 1447 RefPtrWillBeRawPtr<LocalFrame> frame = LocalFrame::create(webFrame->m_frameL oaderClientImpl.get(), oldFrame->host(), tempOwner.get(), serviceRegistry);
1448 // Set the name and unique name directly, bypassing any of the normal logic 1448 // Set the name and unique name directly, bypassing any of the normal logic
1449 // to calculate unique name. 1449 // to calculate unique name.
1450 frame->tree().setPrecalculatedName(toWebRemoteFrameImpl(oldWebFrame)->frame( )->tree().name(), toWebRemoteFrameImpl(oldWebFrame)->frame()->tree().uniqueName( )); 1450 frame->tree().setPrecalculatedName(toWebRemoteFrameImpl(oldWebFrame)->frame( )->tree().name(), toWebRemoteFrameImpl(oldWebFrame)->frame()->tree().uniqueName( ));
1451 webFrame->setCoreFrame(frame); 1451 webFrame->setCoreFrame(frame);
1452 1452
1453 frame->setOwner(oldFrame->owner()); 1453 frame->setOwner(oldFrame->owner());
1454 1454
1455 if (frame->owner() && frame->owner()->isRemote()) { 1455 if (frame->owner() && frame->owner()->isRemote()) {
1456 toRemoteFrameOwner(frame->owner())->setSandboxFlags(static_cast<SandboxF lags>(flags)); 1456 toRemoteFrameOwner(frame->owner())->setSandboxFlags(static_cast<SandboxF lags>(flags));
1457 // Since a remote frame doesn't get the notifications about frame owner 1457 // Since a remote frame doesn't get the notifications about frame owner
1458 // property modifications, we need to sync up those properties here. 1458 // property modifications, we need to sync up those properties here.
1459 webFrame->setFrameOwnerProperties(frameOwnerProperties); 1459 webFrame->setFrameOwnerProperties(frameOwnerProperties);
1460 } 1460 }
1461 1461
1462 // We must call init() after m_frame is assigned because it is referenced 1462 // We must call init() after m_frame is assigned because it is referenced
1463 // during init(). Note that this may dispatch JS events; the frame may be 1463 // during init(). Note that this may dispatch JS events; the frame may be
1464 // detached after init() returns. 1464 // detached after init() returns.
1465 frame->init(); 1465 frame->init();
1466 #if ENABLE(OILPAN) 1466 #if ENABLE(OILPAN)
1467 return webFrame.get(); 1467 return webFrame.get();
1468 #else 1468 #else
1469 return webFrame.release().leakRef(); 1469 return webFrame.release().leakRef();
1470 #endif 1470 #endif
1471 } 1471 }
1472 1472
1473 1473 WebLocalFrameImpl::WebLocalFrameImpl(WebTreeScopeType scope, WebFrameClient* cli ent, ServiceRegistry* serviceRegistry)
1474 WebLocalFrameImpl::WebLocalFrameImpl(WebTreeScopeType scope, WebFrameClient* cli ent)
1475 : WebLocalFrame(scope) 1474 : WebLocalFrame(scope)
1476 , m_frameLoaderClientImpl(FrameLoaderClientImpl::create(this)) 1475 , m_frameLoaderClientImpl(FrameLoaderClientImpl::create(this))
1477 , m_frameWidget(0) 1476 , m_frameWidget(0)
1478 , m_client(client) 1477 , m_client(client)
1479 , m_autofillClient(0) 1478 , m_autofillClient(0)
1480 , m_contentSettingsClient(0) 1479 , m_contentSettingsClient(0)
1481 , m_inputEventsScaleFactorForEmulation(1) 1480 , m_inputEventsScaleFactorForEmulation(1)
1482 , m_userMediaClientImpl(this) 1481 , m_userMediaClientImpl(this)
1483 , m_geolocationClientProxy(GeolocationClientProxy::create(client ? client->g eolocationClient() : 0)) 1482 , m_geolocationClientProxy(GeolocationClientProxy::create(client ? client->g eolocationClient() : 0))
1484 , m_webDevToolsFrontend(0) 1483 , m_webDevToolsFrontend(0)
1484 , m_serviceRegistry(serviceRegistry)
1485 #if ENABLE(OILPAN) 1485 #if ENABLE(OILPAN)
1486 , m_selfKeepAlive(this) 1486 , m_selfKeepAlive(this)
1487 #endif 1487 #endif
1488 { 1488 {
1489 setIndexedDBClientCreateFunction(IndexedDBClientImpl::create); 1489 setIndexedDBClientCreateFunction(IndexedDBClientImpl::create);
1490 frameCount++; 1490 frameCount++;
1491 } 1491 }
1492 1492
1493 WebLocalFrameImpl::WebLocalFrameImpl(WebRemoteFrame* oldWebFrame, WebFrameClient * client) 1493 WebLocalFrameImpl::WebLocalFrameImpl(WebRemoteFrame* oldWebFrame, WebFrameClient * client, ServiceRegistry* serviceRegistry)
1494 : WebLocalFrameImpl(oldWebFrame->inShadowTree() ? WebTreeScopeType::Shadow : WebTreeScopeType::Document, client) 1494 : WebLocalFrameImpl(oldWebFrame->inShadowTree() ? WebTreeScopeType::Shadow : WebTreeScopeType::Document, client, serviceRegistry)
1495 { 1495 {
1496 } 1496 }
1497 1497
1498 WebLocalFrameImpl::~WebLocalFrameImpl() 1498 WebLocalFrameImpl::~WebLocalFrameImpl()
1499 { 1499 {
1500 // The widget for the frame, if any, must have already been closed. 1500 // The widget for the frame, if any, must have already been closed.
1501 ASSERT(!m_frameWidget); 1501 ASSERT(!m_frameWidget);
1502 frameCount--; 1502 frameCount--;
1503 1503
1504 #if !ENABLE(OILPAN) 1504 #if !ENABLE(OILPAN)
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1562 if (RuntimeEnabledFeatures::wakeLockEnabled()) 1562 if (RuntimeEnabledFeatures::wakeLockEnabled())
1563 ScreenWakeLock::provideTo(*m_frame, m_client ? m_client->wakeLockClient( ) : nullptr); 1563 ScreenWakeLock::provideTo(*m_frame, m_client ? m_client->wakeLockClient( ) : nullptr);
1564 if (RuntimeEnabledFeatures::audioOutputDevicesEnabled()) 1564 if (RuntimeEnabledFeatures::audioOutputDevicesEnabled())
1565 provideAudioOutputDeviceClientTo(*m_frame, AudioOutputDeviceClientImpl:: create()); 1565 provideAudioOutputDeviceClientTo(*m_frame, AudioOutputDeviceClientImpl:: create());
1566 if (RuntimeEnabledFeatures::installedAppEnabled()) 1566 if (RuntimeEnabledFeatures::installedAppEnabled())
1567 InstalledAppController::provideTo(*m_frame, m_client ? m_client->install edAppClient() : nullptr); 1567 InstalledAppController::provideTo(*m_frame, m_client ? m_client->install edAppClient() : nullptr);
1568 } 1568 }
1569 1569
1570 void WebLocalFrameImpl::initializeCoreFrame(FrameHost* host, FrameOwner* owner, const AtomicString& name, const AtomicString& uniqueName) 1570 void WebLocalFrameImpl::initializeCoreFrame(FrameHost* host, FrameOwner* owner, const AtomicString& name, const AtomicString& uniqueName)
1571 { 1571 {
1572 setCoreFrame(LocalFrame::create(m_frameLoaderClientImpl.get(), host, owner)) ; 1572 setCoreFrame(LocalFrame::create(m_frameLoaderClientImpl.get(), host, owner, m_serviceRegistry));
1573 frame()->tree().setPrecalculatedName(name, uniqueName); 1573 frame()->tree().setPrecalculatedName(name, uniqueName);
1574 // We must call init() after m_frame is assigned because it is referenced 1574 // We must call init() after m_frame is assigned because it is referenced
1575 // during init(). Note that this may dispatch JS events; the frame may be 1575 // during init(). Note that this may dispatch JS events; the frame may be
1576 // detached after init() returns. 1576 // detached after init() returns.
1577 frame()->init(); 1577 frame()->init();
1578 } 1578 }
1579 1579
1580 PassRefPtrWillBeRawPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const Fra meLoadRequest& request, 1580 PassRefPtrWillBeRawPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const Fra meLoadRequest& request,
1581 const AtomicString& name, HTMLFrameOwnerElement* ownerElement) 1581 const AtomicString& name, HTMLFrameOwnerElement* ownerElement)
1582 { 1582 {
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
2189 return WebSandboxFlags::None; 2189 return WebSandboxFlags::None;
2190 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags( )); 2190 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags( ));
2191 } 2191 }
2192 2192
2193 void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags) 2193 void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags)
2194 { 2194 {
2195 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags)); 2195 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags));
2196 } 2196 }
2197 2197
2198 } // namespace blink 2198 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698