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

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

Issue 2837593002: Nuked WebFrameImplBase. (Closed)
Patch Set: Switched to static methods. Created 3 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 side-by-side diff with in-line comments
Download patch
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..264f8af87e67639e82594bf91f5831eed9cca65f 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 = CoreFrame(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,10 +108,9 @@ bool WebFrame::Swap(WebFrame* frame) {
}
if (parent_ && old_frame->HasReceivedUserGesture())
- frame->ToImplBase()->GetFrame()->SetDocumentHasReceivedUserGesture();
+ CoreFrame(frame)->SetDocumentHasReceivedUserGesture();
- frame->ToImplBase()->GetFrame()->GetWindowProxyManager()->SetGlobalProxies(
- global_proxies);
+ CoreFrame(frame)->GetWindowProxyManager()->SetGlobalProxies(global_proxies);
parent_ = nullptr;
@@ -119,12 +118,12 @@ bool WebFrame::Swap(WebFrame* frame) {
}
void WebFrame::Detach() {
- ToImplBase()->GetFrame()->Detach(FrameDetachType::kRemove);
+ CoreFrame(this)->Detach(FrameDetachType::kRemove);
}
WebSecurityOrigin WebFrame::GetSecurityOrigin() const {
return WebSecurityOrigin(
- ToImplBase()->GetFrame()->GetSecurityContext()->GetSecurityOrigin());
+ CoreFrame(this)->GetSecurityContext()->GetSecurityOrigin());
}
void WebFrame::SetFrameOwnerPolicy(
@@ -132,29 +131,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(CoreFrame(this)->Owner());
DCHECK(owner);
owner->SetSandboxFlags(static_cast<SandboxFlags>(flags));
owner->SetContainerPolicy(container_policy);
}
WebInsecureRequestPolicy WebFrame::GetInsecureRequestPolicy() const {
- return ToImplBase()
- ->GetFrame()
- ->GetSecurityContext()
- ->GetInsecureRequestPolicy();
+ return CoreFrame(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(CoreFrame(this)->Owner());
DCHECK(owner);
- Frame* frame = ToImplBase()->GetFrame();
+ Frame* frame = CoreFrame(this);
DCHECK(frame);
if (frame->IsLocalFrame()) {
@@ -209,8 +203,8 @@ void WebFrame::InsertAfter(WebFrame* new_child, WebFrame* previous_sibling) {
last_child_ = new_child;
}
- ToImplBase()->GetFrame()->Tree().InvalidateScopedChildCount();
- ToImplBase()->GetFrame()->GetPage()->IncrementSubframeCount();
+ CoreFrame(this)->Tree().InvalidateScopedChildCount();
+ CoreFrame(this)->GetPage()->IncrementSubframeCount();
}
void WebFrame::AppendChild(WebFrame* child) {
@@ -234,8 +228,8 @@ void WebFrame::RemoveChild(WebFrame* child) {
child->previous_sibling_ = child->next_sibling_ = 0;
- ToImplBase()->GetFrame()->Tree().InvalidateScopedChildCount();
- ToImplBase()->GetFrame()->GetPage()->DecrementSubframeCount();
+ CoreFrame(this)->Tree().InvalidateScopedChildCount();
+ CoreFrame(this)->GetPage()->DecrementSubframeCount();
}
void WebFrame::SetParent(WebFrame* parent) {
@@ -262,7 +256,7 @@ WebFrame* WebFrame::NextSibling() const {
}
WebFrame* WebFrame::TraverseNext() const {
- if (Frame* frame = ToImplBase()->GetFrame())
+ if (Frame* frame = CoreFrame(this))
return FromFrame(frame->Tree().TraverseNext());
return nullptr;
}
@@ -276,7 +270,7 @@ WebFrame* WebFrame::FromFrameOwnerElement(const WebElement& web_element) {
}
bool WebFrame::IsLoading() const {
- if (Frame* frame = ToImplBase()->GetFrame())
+ if (Frame* frame = CoreFrame(this))
return frame->IsLoading();
return false;
}
@@ -326,4 +320,21 @@ 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);
dcheng 2017/04/26 11:45:33 I think this is missing an else before the NOTREAC
mustaq 2017/04/26 18:12:48 Yikes! Done.
+ NOTREACHED();
+}
+
+Frame* WebFrame::CoreFrame(const WebFrame* frame) {
+ if (frame->IsWebLocalFrame())
+ return ToWebLocalFrameImpl(frame)->GetFrame();
+ if (frame->IsWebRemoteFrame())
+ return ToWebRemoteFrameImpl(frame)->GetFrame();
+ NOTREACHED();
+ return nullptr;
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698