| Index: third_party/WebKit/Source/web/WebFrame.cpp
|
| diff --git a/third_party/WebKit/Source/web/WebFrame.cpp b/third_party/WebKit/Source/web/WebFrame.cpp
|
| index 29bf0d8c04e50f829b0c326208c3b21c650beb84..78684536f81e8520769f3b1ff03679ea53276f70 100644
|
| --- a/third_party/WebKit/Source/web/WebFrame.cpp
|
| +++ b/third_party/WebKit/Source/web/WebFrame.cpp
|
| @@ -28,7 +28,7 @@ namespace blink {
|
|
|
| bool WebFrame::Swap(WebFrame* frame) {
|
| using std::swap;
|
| - Frame* old_frame = ToImplBase()->GetFrame();
|
| + Frame* old_frame = ToCoreFrame(*this);
|
| if (!old_frame->IsAttached())
|
| return false;
|
|
|
| @@ -85,7 +85,7 @@ bool WebFrame::Swap(WebFrame* frame) {
|
| // increments of connected subframes.
|
| if (frame->IsWebLocalFrame()) {
|
| // TODO(dcheng): in an ideal world, both branches would just use
|
| - // WebFrameImplBase's initializeCoreFrame() helper. However, Blink
|
| + // WebFrame's initializeCoreFrame() helper. However, Blink
|
| // currently requires a 'provisional' local frame to serve as a
|
| // placeholder for loading state when swapping to a local frame.
|
| // In this case, the core LocalFrame is already initialized, so just
|
| @@ -108,9 +108,9 @@ bool WebFrame::Swap(WebFrame* frame) {
|
| }
|
|
|
| if (parent_ && old_frame->HasReceivedUserGesture())
|
| - frame->ToImplBase()->GetFrame()->SetDocumentHasReceivedUserGesture();
|
| + ToCoreFrame(*frame)->SetDocumentHasReceivedUserGesture();
|
|
|
| - frame->ToImplBase()->GetFrame()->GetWindowProxyManager()->SetGlobalProxies(
|
| + ToCoreFrame(*frame)->GetWindowProxyManager()->SetGlobalProxies(
|
| global_proxies);
|
|
|
| parent_ = nullptr;
|
| @@ -119,12 +119,12 @@ bool WebFrame::Swap(WebFrame* frame) {
|
| }
|
|
|
| void WebFrame::Detach() {
|
| - ToImplBase()->GetFrame()->Detach(FrameDetachType::kRemove);
|
| + ToCoreFrame(*this)->Detach(FrameDetachType::kRemove);
|
| }
|
|
|
| WebSecurityOrigin WebFrame::GetSecurityOrigin() const {
|
| return WebSecurityOrigin(
|
| - ToImplBase()->GetFrame()->GetSecurityContext()->GetSecurityOrigin());
|
| + ToCoreFrame(*this)->GetSecurityContext()->GetSecurityOrigin());
|
| }
|
|
|
| void WebFrame::SetFrameOwnerPolicy(
|
| @@ -132,29 +132,24 @@ void WebFrame::SetFrameOwnerPolicy(
|
| const blink::WebParsedFeaturePolicy& container_policy) {
|
| // At the moment, this is only used to replicate sandbox flags and container
|
| // policy for frames with a remote owner.
|
| - RemoteFrameOwner* owner =
|
| - ToRemoteFrameOwner(ToImplBase()->GetFrame()->Owner());
|
| + RemoteFrameOwner* owner = ToRemoteFrameOwner(ToCoreFrame(*this)->Owner());
|
| DCHECK(owner);
|
| owner->SetSandboxFlags(static_cast<SandboxFlags>(flags));
|
| owner->SetContainerPolicy(container_policy);
|
| }
|
|
|
| WebInsecureRequestPolicy WebFrame::GetInsecureRequestPolicy() const {
|
| - return ToImplBase()
|
| - ->GetFrame()
|
| - ->GetSecurityContext()
|
| - ->GetInsecureRequestPolicy();
|
| + return ToCoreFrame(*this)->GetSecurityContext()->GetInsecureRequestPolicy();
|
| }
|
|
|
| void WebFrame::SetFrameOwnerProperties(
|
| const WebFrameOwnerProperties& properties) {
|
| // At the moment, this is only used to replicate frame owner properties
|
| // for frames with a remote owner.
|
| - RemoteFrameOwner* owner =
|
| - ToRemoteFrameOwner(ToImplBase()->GetFrame()->Owner());
|
| + RemoteFrameOwner* owner = ToRemoteFrameOwner(ToCoreFrame(*this)->Owner());
|
| DCHECK(owner);
|
|
|
| - Frame* frame = ToImplBase()->GetFrame();
|
| + Frame* frame = ToCoreFrame(*this);
|
| DCHECK(frame);
|
|
|
| if (frame->IsLocalFrame()) {
|
| @@ -209,8 +204,8 @@ void WebFrame::InsertAfter(WebFrame* new_child, WebFrame* previous_sibling) {
|
| last_child_ = new_child;
|
| }
|
|
|
| - ToImplBase()->GetFrame()->Tree().InvalidateScopedChildCount();
|
| - ToImplBase()->GetFrame()->GetPage()->IncrementSubframeCount();
|
| + ToCoreFrame(*this)->Tree().InvalidateScopedChildCount();
|
| + ToCoreFrame(*this)->GetPage()->IncrementSubframeCount();
|
| }
|
|
|
| void WebFrame::AppendChild(WebFrame* child) {
|
| @@ -234,8 +229,8 @@ void WebFrame::RemoveChild(WebFrame* child) {
|
|
|
| child->previous_sibling_ = child->next_sibling_ = 0;
|
|
|
| - ToImplBase()->GetFrame()->Tree().InvalidateScopedChildCount();
|
| - ToImplBase()->GetFrame()->GetPage()->DecrementSubframeCount();
|
| + ToCoreFrame(*this)->Tree().InvalidateScopedChildCount();
|
| + ToCoreFrame(*this)->GetPage()->DecrementSubframeCount();
|
| }
|
|
|
| void WebFrame::SetParent(WebFrame* parent) {
|
| @@ -262,7 +257,7 @@ WebFrame* WebFrame::NextSibling() const {
|
| }
|
|
|
| WebFrame* WebFrame::TraverseNext() const {
|
| - if (Frame* frame = ToImplBase()->GetFrame())
|
| + if (Frame* frame = ToCoreFrame(*this))
|
| return FromFrame(frame->Tree().TraverseNext());
|
| return nullptr;
|
| }
|
| @@ -276,7 +271,7 @@ WebFrame* WebFrame::FromFrameOwnerElement(const WebElement& web_element) {
|
| }
|
|
|
| bool WebFrame::IsLoading() const {
|
| - if (Frame* frame = ToImplBase()->GetFrame())
|
| + if (Frame* frame = ToCoreFrame(*this))
|
| return frame->IsLoading();
|
| return false;
|
| }
|
| @@ -326,4 +321,22 @@ void WebFrame::Close() {
|
| opened_frame_tracker_->Dispose();
|
| }
|
|
|
| +void WebFrame::InitializeCoreFrame(WebFrame& frame, Page& page) {
|
| + if (frame.IsWebLocalFrame())
|
| + ToWebLocalFrameImpl(frame).InitializeCoreFrame(page, 0, g_null_atom);
|
| + else if (frame.IsWebRemoteFrame())
|
| + ToWebRemoteFrameImpl(frame).InitializeCoreFrame(page, 0, g_null_atom);
|
| + else
|
| + NOTREACHED();
|
| +}
|
| +
|
| +Frame* WebFrame::ToCoreFrame(const WebFrame& frame) {
|
| + if (frame.IsWebLocalFrame())
|
| + return ToWebLocalFrameImpl(frame).GetFrame();
|
| + if (frame.IsWebRemoteFrame())
|
| + return ToWebRemoteFrameImpl(frame).GetFrame();
|
| + NOTREACHED();
|
| + return nullptr;
|
| +}
|
| +
|
| } // namespace blink
|
|
|