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

Unified Diff: third_party/WebKit/Source/web/WebLocalFrameImpl.cpp

Issue 1467123003: Create base class for common functionality of Web{Local,Remote}Frame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: --no-find-copies Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
diff --git a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
index 4cb7d027f8e9302666faadc7677f12e37094d8e5..5a7ca38883227df3c68e63661d4a440211fb4fba 100644
--- a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
+++ b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
@@ -944,7 +944,7 @@ v8::Local<v8::Context> WebLocalFrameImpl::mainWorldScriptContext() const
bool WebFrame::scriptCanAccess(WebFrame* target)
{
- return BindingSecurity::shouldAllowAccessToFrame(mainThreadIsolate(), callingDOMWindow(mainThreadIsolate()), toCoreFrame(target), DoNotReportSecurityError);
+ return BindingSecurity::shouldAllowAccessToFrame(mainThreadIsolate(), callingDOMWindow(mainThreadIsolate()), target->toImplBase()->frame(), DoNotReportSecurityError);
}
void WebLocalFrameImpl::reload(bool ignoreCache)
@@ -1721,16 +1721,14 @@ void WebLocalFrameImpl::setCoreFrame(PassRefPtrWillBeRawPtr<LocalFrame> frame)
}
}
-PassRefPtrWillBeRawPtr<LocalFrame> WebLocalFrameImpl::initializeCoreFrame(FrameHost* host, FrameOwner* owner, const AtomicString& name, const AtomicString& fallbackName)
+void WebLocalFrameImpl::initializeCoreFrame(FrameHost* host, FrameOwner* owner, const AtomicString& name, const AtomicString& fallbackName)
{
- RefPtrWillBeRawPtr<LocalFrame> frame = LocalFrame::create(m_frameLoaderClientImpl.get(), host, owner);
- setCoreFrame(frame);
- frame->tree().setName(name, fallbackName);
+ setCoreFrame(LocalFrame::create(m_frameLoaderClientImpl.get(), host, owner));
+ frame()->tree().setName(name, fallbackName);
// We must call init() after m_frame is assigned because it is referenced
// during init(). Note that this may dispatch JS events; the frame may be
// detached after init() returns.
- frame->init();
- return frame;
+ frame()->init();
}
PassRefPtrWillBeRawPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const FrameLoadRequest& request,
@@ -1750,10 +1748,10 @@ PassRefPtrWillBeRawPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const Fra
// solution. subResourceAttributeName returns just one attribute name. The
// element might not have the attribute, and there might be other attributes
// which can identify the element.
- RefPtrWillBeRawPtr<LocalFrame> child = webframeChild->initializeCoreFrame(frame()->host(), ownerElement, name, ownerElement->getAttribute(ownerElement->subResourceAttributeName()));
+ webframeChild->initializeCoreFrame(frame()->host(), ownerElement, name, ownerElement->getAttribute(ownerElement->subResourceAttributeName()));
// Initializing the core frame may cause the new child to be detached, since
// it may dispatch a load event in the parent.
- if (!child->tree().parent())
+ if (!webframeChild->parent())
return nullptr;
// If we're moving in the back/forward list, we might want to replace the content
@@ -1769,14 +1767,14 @@ PassRefPtrWillBeRawPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const Fra
FrameLoader::resourceRequestFromHistoryItem(childItem.get(), UseProtocolCachePolicy));
loadType = FrameLoadTypeInitialHistoryLoad;
}
- child->loader().load(newRequest, loadType, childItem.get());
+ webframeChild->frame()->loader().load(newRequest, loadType, childItem.get());
// Note a synchronous navigation (about:blank) would have already processed
// onload, so it is possible for the child frame to have already been
// detached by script in the page.
- if (!child->tree().parent())
+ if (!webframeChild->parent())
return nullptr;
- return child;
+ return webframeChild->frame();
}
void WebLocalFrameImpl::didChangeContentsSize(const IntSize& size)
@@ -1984,7 +1982,7 @@ static void ensureFrameLoaderHasCommitted(FrameLoader& frameLoader)
void WebLocalFrameImpl::initializeToReplaceRemoteFrame(WebRemoteFrame* oldWebFrame, const WebString& name, WebSandboxFlags flags, const WebFrameOwnerProperties& frameOwnerProperties)
{
- Frame* oldFrame = toCoreFrame(oldWebFrame);
+ Frame* oldFrame = oldWebFrame->toImplBase()->frame();
// Note: this *always* temporarily sets a frame owner, even for main frames!
// When a core Frame is created with no owner, it attempts to set itself as
// the main frame of the Page. However, this is a provisional frame, and may
@@ -2040,7 +2038,7 @@ void WebLocalFrameImpl::setFrameOwnerProperties(const WebFrameOwnerProperties& f
{
// At the moment, this is only used to replicate frame owner properties
// for frames with a remote owner.
- FrameOwner* owner = toCoreFrame(this)->owner();
+ FrameOwner* owner = frame()->owner();
ASSERT(owner);
toRemoteBridgeFrameOwner(owner)->setScrollingMode(frameOwnerProperties.scrollingMode);
toRemoteBridgeFrameOwner(owner)->setMarginWidth(frameOwnerProperties.marginWidth);

Powered by Google App Engine
This is Rietveld 408576698