Commit bd1f027e authored by Dave Tapuska's avatar Dave Tapuska Committed by Commit Bot

Move FrameMsg_Collapse to mojo.

Remove Collapse from the WebFrame interface and move it directly
to the LocalFrame/RemoteFrame interfaces.

BUG=1008432

Change-Id: Ib8a7ce13b76a9618e075e175db8649f0c8ed7b71
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1920479Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/master@{#717651}
parent 8e7a16f3
......@@ -965,13 +965,11 @@ void RenderFrameHostManager::OnDidChangeCollapsedState(bool collapsed) {
// FrameOwner in the parent via the child's current RenderFrame at any time.
DCHECK(current_frame_host());
if (current_frame_host()->GetSiteInstance() == parent_site_instance) {
current_frame_host()->Send(
new FrameMsg_Collapse(current_frame_host()->GetRoutingID(), collapsed));
current_frame_host()->GetAssociatedLocalFrame()->Collapse(collapsed);
} else {
RenderFrameProxyHost* proxy_to_parent =
GetRenderFrameProxyHost(parent_site_instance);
proxy_to_parent->Send(
new FrameMsg_Collapse(proxy_to_parent->GetRoutingID(), collapsed));
proxy_to_parent->GetAssociatedRemoteFrame()->Collapse(collapsed);
}
}
......
......@@ -738,11 +738,6 @@ IPC_MESSAGE_ROUTED1(FrameMsg_SetAccessibilityMode, ui::AXMode)
IPC_MESSAGE_ROUTED1(FrameMsg_ForwardResourceTimingToParent,
content::ResourceTimingInfo)
// Sent to a subframe to control whether to collapse its the frame owner element
// in the embedder document, that is, to remove it from the layout as if it did
// not exist.
IPC_MESSAGE_ROUTED1(FrameMsg_Collapse, bool /* collapsed */)
// Notifies the frame that its parent has changed the frame's sandbox flags or
// container policy.
IPC_MESSAGE_ROUTED1(FrameMsg_DidUpdateFramePolicy, blink::FramePolicy)
......
......@@ -35,6 +35,8 @@ void FakeLocalFrame::AddMessageToConsole(
void FakeLocalFrame::CheckCompleted() {}
void FakeLocalFrame::Collapse(bool collapsed) {}
void FakeLocalFrame::BindFrameHostReceiver(
mojo::ScopedInterfaceEndpointHandle handle) {
receiver_.Bind(mojo::PendingAssociatedReceiver<blink::mojom::LocalFrame>(
......
......@@ -33,6 +33,7 @@ class FakeLocalFrame : public blink::mojom::LocalFrame {
const std::string& message,
bool discard_duplicates) override;
void CheckCompleted() override;
void Collapse(bool collapsed) override;
private:
void BindFrameHostReceiver(mojo::ScopedInterfaceEndpointHandle handle);
......
......@@ -2199,7 +2199,6 @@ bool RenderFrameImpl::OnMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER(UnfreezableFrameMsg_SwapOut, OnSwapOut)
IPC_MESSAGE_HANDLER(FrameMsg_SwapIn, OnSwapIn)
IPC_MESSAGE_HANDLER(FrameMsg_Stop, OnStop)
IPC_MESSAGE_HANDLER(FrameMsg_Collapse, OnCollapse)
IPC_MESSAGE_HANDLER(FrameMsg_ContextMenuClosed, OnContextMenuClosed)
IPC_MESSAGE_HANDLER(FrameMsg_CustomContextMenuAction,
OnCustomContextMenuAction)
......@@ -5387,10 +5386,6 @@ void RenderFrameImpl::OnDroppedNavigation() {
frame_->DidDropNavigation();
}
void RenderFrameImpl::OnCollapse(bool collapsed) {
frame_->Collapse(collapsed);
}
void RenderFrameImpl::WasHidden() {
frame_->WasHidden();
for (auto& observer : observers_)
......
......@@ -1072,7 +1072,6 @@ class CONTENT_EXPORT RenderFrameImpl
const FrameReplicationState& replicated_frame_state);
void OnDeleteFrame(FrameDeleteIntention intent);
void OnStop();
void OnCollapse(bool collapse);
void OnShowContextMenu(const gfx::Point& location);
void OnContextMenuClosed(const CustomContextMenuContext& custom_context);
void OnCustomContextMenuAction(const CustomContextMenuContext& custom_context,
......
......@@ -411,7 +411,6 @@ bool RenderFrameProxy::OnMessageReceived(const IPC::Message& msg) {
OnForwardResourceTimingToParent)
IPC_MESSAGE_HANDLER(FrameMsg_SetNeedsOcclusionTracking,
OnSetNeedsOcclusionTracking)
IPC_MESSAGE_HANDLER(FrameMsg_Collapse, OnCollapse)
IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateName, OnDidUpdateName)
IPC_MESSAGE_HANDLER(FrameMsg_AddContentSecurityPolicies,
OnAddContentSecurityPolicies)
......@@ -507,10 +506,6 @@ void RenderFrameProxy::OnSetNeedsOcclusionTracking(bool needs_tracking) {
web_frame_->SetNeedsOcclusionTracking(needs_tracking);
}
void RenderFrameProxy::OnCollapse(bool collapsed) {
web_frame_->Collapse(collapsed);
}
void RenderFrameProxy::OnDidUpdateName(const std::string& name,
const std::string& unique_name) {
web_frame_->SetReplicatedName(blink::WebString::FromUTF8(name));
......
......@@ -239,7 +239,6 @@ class CONTENT_EXPORT RenderFrameProxy : public IPC::Listener,
void OnForwardResourceTimingToParent(
const ResourceTimingInfo& resource_timing);
void OnSetNeedsOcclusionTracking(bool);
void OnCollapse(bool collapsed);
void OnDidUpdateName(const std::string& name, const std::string& unique_name);
void OnAddContentSecurityPolicies(
const std::vector<ContentSecurityPolicyHeader>& header);
......
......@@ -137,6 +137,12 @@ interface LocalFrame {
// Sent to a frame when one of its remote children finishes loading, so that the
// frame can update its loading state.
CheckCompleted();
// Sent to the process that owns this frame's HTMLFrameOwnerElement to
// control whether the element is collapsed or not. If the element is
// collapsed, it will be removed from the layout tree of its parent
// frame's document.
Collapse(bool collapsed);
};
// Implemented in Browser, this interface defines frame-specific methods that will
......@@ -196,4 +202,10 @@ interface RemoteFrame {
// Sent to dispatch a load event in the frame's owner element.
// (eg. the iframe, portal, or object element).
DispatchLoadEventForFrameOwner();
// Sent to the process that owns this frame's HTMLFrameOwnerElement to
// control whether the element is collapsed or not. If the element is
// collapsed, it will be removed from the layout tree of its parent
// frame's document.
Collapse(bool collapsed);
};
......@@ -118,11 +118,6 @@ class BLINK_EXPORT WebFrame {
// navigation. This matches the in-process frame behavior.
void SetFrameOwnerProperties(const WebFrameOwnerProperties&);
// Whether to collapse the frame's owner element in the embedder document,
// that is, to remove it from the layout as if it did not exist. Only works
// for <iframe> owner elements.
void Collapse(bool);
// Hierarchy ----------------------------------------------------------
// Returns the containing view.
......
......@@ -202,11 +202,6 @@ void WebFrame::SetFrameOwnerProperties(
owner->SetRequiredCsp(properties.required_csp);
}
void WebFrame::Collapse(bool collapsed) {
FrameOwner* owner = ToCoreFrame(*this)->Owner();
To<HTMLFrameOwnerElement>(owner)->SetCollapsed(collapsed);
}
WebFrame* WebFrame::Opener() const {
return opener_;
}
......
......@@ -1850,6 +1850,11 @@ void LocalFrame::AddMessageToConsole(mojom::blink::ConsoleMessageLevel level,
discard_duplicates);
}
void LocalFrame::Collapse(bool collapsed) {
FrameOwner* owner = Owner();
To<HTMLFrameOwnerElement>(owner)->SetCollapsed(collapsed);
}
void LocalFrame::BindToReceiver(
blink::LocalFrame* frame,
mojo::PendingAssociatedReceiver<mojom::blink::LocalFrame> receiver) {
......
......@@ -461,6 +461,7 @@ class CORE_EXPORT LocalFrame final : public Frame,
void AddMessageToConsole(mojom::blink::ConsoleMessageLevel level,
const WTF::String& message,
bool discard_duplicates) final;
void Collapse(bool collapsed) final;
private:
friend class FrameNavigationDisabler;
......
......@@ -317,6 +317,11 @@ void RemoteFrame::DispatchLoadEventForFrameOwner() {
Owner()->DispatchLoad();
}
void RemoteFrame::Collapse(bool collapsed) {
FrameOwner* owner = Owner();
To<HTMLFrameOwnerElement>(owner)->SetCollapsed(collapsed);
}
bool RemoteFrame::IsIgnoredForHitTest() const {
HTMLFrameOwnerElement* owner = DeprecatedLocalOwner();
if (!owner || !owner->GetLayoutObject())
......
......@@ -91,6 +91,7 @@ class CORE_EXPORT RemoteFrame final : public Frame,
const scoped_refptr<const SecurityOrigin>& origin,
bool is_potentially_trustworthy_unique_origin) override;
void DispatchLoadEventForFrameOwner() override;
void Collapse(bool collapsed) final;
private:
// Frame protected overrides:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment